Browse Source

Make possible to pick both files and folders

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
tags/v14.0.0RC2
Daniel Calviño Sánchez 5 years ago
parent
commit
c14c6e5ccf
1 changed files with 9 additions and 1 deletions
  1. 9
    1
      core/js/oc-dialogs.js

+ 9
- 1
core/js/oc-dialogs.js View File

@@ -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;
});

Loading…
Cancel
Save