summaryrefslogtreecommitdiffstats
path: root/apps/files/tests/js/filesSpec.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/tests/js/filesSpec.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/tests/js/filesSpec.js')
-rw-r--r--apps/files/tests/js/filesSpec.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/apps/files/tests/js/filesSpec.js b/apps/files/tests/js/filesSpec.js
index 018c8ef0f3c..95bf87e03ec 100644
--- a/apps/files/tests/js/filesSpec.js
+++ b/apps/files/tests/js/filesSpec.js
@@ -48,6 +48,41 @@ describe('Files tests', function() {
expect(error).toEqual(false);
}
});
+ it('Validates correct file names do not create Shared folder in root', function() {
+ // create shared file in subfolder
+ var error = false;
+ try {
+ expect(Files.isFileNameValid('shared', '/foo')).toEqual(true);
+ expect(Files.isFileNameValid('Shared', '/foo')).toEqual(true);
+ }
+ catch (e) {
+ error = e;
+ }
+ expect(error).toEqual(false);
+
+ // create shared file in root
+ var threwException = false;
+ try {
+ Files.isFileNameValid('Shared', '/');
+ console.error('Invalid file name not detected');
+ }
+ catch (e) {
+ threwException = true;
+ }
+ expect(threwException).toEqual(true);
+
+ // create shared file in root
+ var threwException = false;
+ try {
+ Files.isFileNameValid('shared', '/');
+ console.error('Invalid file name not detected');
+ }
+ catch (e) {
+ threwException = true;
+ }
+ expect(threwException).toEqual(true);
+
+ });
it('Detects invalid file names', function() {
var fileNames = [
'',