aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-03-04 16:42:40 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-03-05 13:16:25 +0100
commit2e73c957e5b3ae4030e41520088fb078354ae8b1 (patch)
tree7c6243510a969fc370141f452f3e8575b09db316 /apps/files/js/files.js
parent79ae3c4527b492bee76b2951ca14e8259147b181 (diff)
downloadnextcloud-server-2e73c957e5b3ae4030e41520088fb078354ae8b1.tar.gz
nextcloud-server-2e73c957e5b3ae4030e41520088fb078354ae8b1.zip
don't allow to create a file or folder named 'Shared' in the root folder, also exclude all combinations of lower and upper case letters
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r--apps/files/js/files.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index f4546120702..48e5771ae8a 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -87,9 +87,12 @@ var Files = {
* Throws a string exception with an error message if
* the file name is not valid
*/
- isFileNameValid: function (name) {
+ isFileNameValid: function (name, root) {
var trimmedName = name.trim();
- if (trimmedName === '.' || trimmedName === '..') {
+ if (trimmedName === '.'
+ || trimmedName === '..'
+ || (root === '/' && trimmedName.toLowerCase() === 'shared'))
+ {
throw t('files', '"{name}" is an invalid file name.', {name: name});
} else if (trimmedName.length === 0) {
throw t('files', 'File name cannot be empty.');