From 31745d69f724a89e17632c82e7d76e104cc2764f Mon Sep 17 00:00:00 2001
From: Robin Appelman <robin@icewind.nl>
Date: Wed, 19 Oct 2016 14:22:33 +0200
Subject: [PATCH] fix filepicker with no mimetype filter

Signed-off-by: Robin Appelman <robin@icewind.nl>
---
 core/js/oc-dialogs.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 8df62a1842e..7a7876bf30f 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -754,9 +754,12 @@ var OCdialogs = {
 			filter = [filter];
 		}
 		self.filepicker.filesClient.getFolderContents(dir).then(function(status, files) {
-			files = files.filter(function(file) {
-				return file.type === 'dir' || filter.indexOf(file.mimetype) !== -1;
-			}).sort(function(a, b) {
+			if (filter) {
+				files = files.filter(function (file) {
+					return filter == [] || file.type === 'dir' || filter.indexOf(file.mimetype) !== -1;
+				});
+			}
+			files = files.sort(function(a, b) {
 				if (a.type === 'dir' && b.type !== 'dir') {
 					return -1;
 				} else if(a.type !== 'dir' && b.type === 'dir') {
-- 
GitLab