Skip to content

Commit 14615e5

Browse files
author
mahsa shadi
committed
Ignore vfs client options from being send to the server
1 parent 0701f30 commit 14615e5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/adapters/vfs/system.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const methods = (core, request) => {
8989
stat: passthrough('stat'),
9090

9191
url: ({path}, options) => Promise.resolve(
92-
core.url(`/vfs/readfile?path=${encodeURIComponent(path)}`)
92+
core.url(`/vfs/readfile?path.s=${encodeURIComponent(path)}`)
9393
),
9494

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

105-
return Promise.resolve(`/vfs/readfile?options=${json}&path=` + encodeURIComponent(path))
105+
return Promise.resolve(`/vfs/readfile?options=${json}&path.s=` + encodeURIComponent(path))
106106
.then(url => {
107107
return (options.target || window).open(url);
108108
});

src/vfs.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ const handleDirectoryList = (path, options) => result =>
7474
filter: options.filter
7575
}));
7676

77+
// Returns a new "options" object without properties from "ignore"
78+
const filterOptions = (ignore, options) => {
79+
ignore.forEach(item => delete options[item]);
80+
return options;
81+
};
82+
7783
/**
7884
* Read a directory
7985
*
@@ -82,7 +88,7 @@ const handleDirectoryList = (path, options) => result =>
8288
* @return {Promise<object[]>} A list of files
8389
*/
8490
export const readdir = (adapter, mount) => (path, options = {}) =>
85-
adapter.readdir(pathToObject(path), options, mount)
91+
adapter.readdir(pathToObject(path), filterOptions(['showHiddenFiles', 'filter'], options), mount)
8692
.then(handleDirectoryList(path, options));
8793

8894
/**

0 commit comments

Comments
 (0)