diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-07-01 15:00:31 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-07-01 15:00:31 +0200 |
commit | 8aa0832bd449c44ec300da4189bd8ed4e036140c (patch) | |
tree | ba775321c6e5fa37375cdab1e57648f28ebe1885 /apps | |
parent | 2da43e3751576bbc838f238a09955c4dcdebee8e (diff) | |
download | nextcloud-server-8aa0832bd449c44ec300da4189bd8ed4e036140c.tar.gz nextcloud-server-8aa0832bd449c44ec300da4189bd8ed4e036140c.zip |
Match for /../
Diffstat (limited to 'apps')
-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); |