diff options
-rw-r--r-- | apps/files/js/filelist.js | 2 | ||||
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 649661a5f01..c0d72a0f194 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1333,7 +1333,7 @@ * @param changeUrl true to also update the URL, false otherwise (default) */ _setCurrentDir: function(targetDir, changeUrl) { - targetDir = targetDir.replace(/\\/g, '/').replace(/\.\.\//g, ''); + targetDir = targetDir.replace(/\\/g, '/').replace(/\/\.\.\//g, '/'); var previousDir = this.getCurrentDirectory(), baseDir = OC.basename(targetDir); diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index bab3d45be4a..9dbdb889eac 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -1327,6 +1327,10 @@ describe('OCA.Files.FileList tests', function() { fileList.changeDirectory('/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../'); expect(fileList.getCurrentDirectory()).toEqual('/another/subdir/foo/bar/file/folder/'); }); + it('does not convert folders with a ".." in the name', function() { + fileList.changeDirectory('/abc../def'); + expect(fileList.getCurrentDirectory()).toEqual('/abc../def'); + }); it('switches to root dir when current directory does not exist', function() { fileList.changeDirectory('/unexist'); deferredList.reject(404); |