summaryrefslogtreecommitdiffstats
path: root/apps/files/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/tests')
-rw-r--r--apps/files/tests/js/filelistSpec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index a74e1c7328c..d8d3057ec3e 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -1334,6 +1334,31 @@ describe('OCA.Files.FileList tests', function() {
fileList.changeDirectory('/another\\subdir');
expect(fileList.getCurrentDirectory()).toEqual('/another/subdir');
});
+ it('switches to root dir when current directory is invalid', function() {
+ _.each([
+ '..',
+ '/..',
+ '../',
+ '/../',
+ '/../abc',
+ '/abc/..',
+ '/abc/../',
+ '/../abc/'
+ ], function(path) {
+ fileList.changeDirectory(path);
+ expect(fileList.getCurrentDirectory()).toEqual('/');
+ });
+ });
+ it('allows paths with dotdot at the beginning or end', function() {
+ _.each([
+ '..abc',
+ 'def..',
+ '...'
+ ], function(path) {
+ fileList.changeDirectory(path);
+ expect(fileList.getCurrentDirectory()).toEqual(path);
+ });
+ });
it('switches to root dir when current directory does not exist', function() {
fileList.changeDirectory('/unexist');
deferredList.reject(404);