diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-08-30 14:40:12 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-08-30 14:40:12 +0200 |
commit | c14c6e5ccf55f1f6170520b161381a415dd8e4d8 (patch) | |
tree | b3b549c63384f161cab4d92a6413a5f20f7792c7 /core/js | |
parent | f080fa55ac606b498e3e1144a5fb58513e7ad1a3 (diff) | |
download | nextcloud-server-c14c6e5ccf55f1f6170520b161381a415dd8e4d8.tar.gz nextcloud-server-c14c6e5ccf55f1f6170520b161381a415dd8e4d8.zip |
Make possible to pick both files and folders
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/oc-dialogs.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index ee1e84033d4..7369298b8d5 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -175,6 +175,14 @@ var OCdialogs = { }, /** * show a file picker to pick a file from + * + * In order to pick several types of mime types they need to be passed as an + * array of strings. + * + * When no mime type filter is given only files can be selected. In order to + * be able to select both files and folders "['*', 'httpd/unix-directory']" + * should be used instead. + * * @param title dialog title * @param callback which will be triggered when user presses Choose * @param multiselect whether it should be possible to select multiple files @@ -846,7 +854,7 @@ var OCdialogs = { filter = [filter]; } self.filepicker.filesClient.getFolderContents(dir).then(function(status, files) { - if (filter && filter.length > 0) { + if (filter && filter.length > 0 && filter.indexOf('*') === -1) { files = files.filter(function (file) { return file.type === 'dir' || filter.indexOf(file.mimetype) !== -1; }); |