Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/adapters/vfs/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const methods = (core, request) => {
return {
readdir: ({path}, options) => request('readdir', {
path,
options: {}
options,
}, 'json').then(({body}) => body),

readfile: ({path}, type, options) =>
Expand Down Expand Up @@ -89,7 +89,7 @@ const methods = (core, request) => {
stat: passthrough('stat'),

url: ({path}, options) => Promise.resolve(
core.url(`/vfs/readfile?path=${encodeURIComponent(path)}`)
core.url(`/vfs/readfile?path.s=${encodeURIComponent(path)}`)
),

search: ({path}, pattern, options) =>
Expand All @@ -102,7 +102,7 @@ const methods = (core, request) => {
download: ({path}, options = {}) => {
const json = encodeURIComponent(JSON.stringify({download: true}));

return Promise.resolve(`/vfs/readfile?options=${json}&path=` + encodeURIComponent(path))
return Promise.resolve(`/vfs/readfile?options=${json}&path.s=` + encodeURIComponent(path))
.then(url => {
return (options.target || window).open(url);
});
Expand Down
8 changes: 7 additions & 1 deletion src/vfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ const handleDirectoryList = (path, options) => result =>
filter: options.filter
}));

// Returns a new "options" object without properties from "ignore"
const filterOptions = (ignore, options) => {
ignore.forEach(item => delete options[item]);
return options;
};

/**
* Read a directory
*
Expand All @@ -82,7 +88,7 @@ const handleDirectoryList = (path, options) => result =>
* @return {Promise<object[]>} A list of files
*/
export const readdir = (adapter, mount) => (path, options = {}) =>
adapter.readdir(pathToObject(path), options, mount)
adapter.readdir(pathToObject(path), filterOptions(['showHiddenFiles', 'filter'], options), mount)
.then(handleDirectoryList(path, options));

/**
Expand Down