mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
Fix empty mime type filter
When the mime type is an empty array no filter should be applied. However, the filter was loosely compared to an empty array, but as arrays are objects then it became an implicit strict equality comparison which always failed due to being different objects. Now the length of the array is compared instead, and also moved outside the loop as it is not needed to check it for each file. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
4508a12188
commit
66f2b155ce
1 changed files with 2 additions and 2 deletions
|
|
@ -841,9 +841,9 @@ var OCdialogs = {
|
|||
filter = [filter];
|
||||
}
|
||||
self.filepicker.filesClient.getFolderContents(dir).then(function(status, files) {
|
||||
if (filter) {
|
||||
if (filter && filter.length > 0) {
|
||||
files = files.filter(function (file) {
|
||||
return filter == [] || file.type === 'dir' || filter.indexOf(file.mimetype) !== -1;
|
||||
return file.type === 'dir' || filter.indexOf(file.mimetype) !== -1;
|
||||
});
|
||||
}
|
||||
files = files.sort(function(a, b) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue