]> source.dussan.org Git - nextcloud-server.git/commitdiff
validate file name before uploading in upload only folder
authorArtur Neumann <info@individual-it.net>
Wed, 5 Apr 2017 07:12:41 +0000 (12:57 +0545)
committerArtur Neumann <info@individual-it.net>
Wed, 5 Apr 2017 07:41:40 +0000 (13:26 +0545)
fixes #4211

Signed-off-by: Artur Neumann <info@individual-it.net>
apps/files_sharing/js/files_drop.js

index 64051844d037a47f26eae539e1b759bf9864e270..ba5bd82cc4967246fd078feaf68ef06a65c89542 100644 (file)
                                        var errors = [];
 
                                        var name = data.files[0].name;
-
+                                       try {
+                                               // FIXME: not so elegant... need to refactor that method to return a value
+                                               Files.isFileNameValid(name);
+                                       }
+                                       catch (errorMessage) {
+                                               OC.Notification.show(errorMessage, {type: 'error'});
+                                               return false;
+                                       }
                                        var base = OC.getProtocol() + '://' + OC.getHost();
                                        data.url = base + OC.getRootPath() + '/public.php/webdav/' + encodeURI(name);