aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2014-03-05 18:13:31 +0100
committerBjörn Schießle <schiessle@owncloud.com>2014-03-05 18:13:31 +0100
commit9111af04780b547918a8661579d330d8d41c3e98 (patch)
treef0567dbdbf9a351af2da5321a895152c31d106d5 /apps/files/js/files.js
parent36fcb0fb4efd2897c1f286a04c2f46691f8ddc08 (diff)
parent2e73c957e5b3ae4030e41520088fb078354ae8b1 (diff)
downloadnextcloud-server-9111af04780b547918a8661579d330d8d41c3e98.tar.gz
nextcloud-server-9111af04780b547918a8661579d330d8d41c3e98.zip
Merge pull request #7531 from owncloud/dont_create_shared_folder
don't allow to create a file or folder named 'Shared' in the root folder
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.');