validate file name before uploading in upload only folder

fixes #4211

Signed-off-by: Artur Neumann <info@individual-it.net>
This commit is contained in:
Artur Neumann 2017-04-05 12:57:41 +05:45
parent 84035862f7
commit 3795636b90
1 changed files with 8 additions and 1 deletions

View File

@ -46,7 +46,14 @@
var errors = []; var errors = [];
var name = data.files[0].name; 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(); var base = OC.getProtocol() + '://' + OC.getHost();
data.url = base + OC.getRootPath() + '/public.php/webdav/' + encodeURI(name); data.url = base + OC.getRootPath() + '/public.php/webdav/' + encodeURI(name);