From 3795636b9073a2204036bfe2b581acb187dfcba6 Mon Sep 17 00:00:00 2001 From: Artur Neumann Date: Wed, 5 Apr 2017 12:57:41 +0545 Subject: [PATCH] validate file name before uploading in upload only folder fixes #4211 Signed-off-by: Artur Neumann --- apps/files_sharing/js/files_drop.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js index 64051844d0..ba5bd82cc4 100644 --- a/apps/files_sharing/js/files_drop.js +++ b/apps/files_sharing/js/files_drop.js @@ -46,7 +46,14 @@ 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);