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:01:48 +0200 |
commit | 4ac9eaab0379cc0535a6ab18be0fa147facf1bd5 (patch) | |
tree | 4416c8478e9ad1bb388f23006ee8da749a3bf95b /apps | |
parent | 5b65591d84a0dafb9415539eef75424004f6a4f6 (diff) | |
download | nextcloud-server-4ac9eaab0379cc0535a6ab18be0fa147facf1bd5.tar.gz nextcloud-server-4ac9eaab0379cc0535a6ab18be0fa147facf1bd5.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 1f19c2a6258..506d423c817 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1404,7 +1404,7 @@ * @param {string} [fileId] file id */ _setCurrentDir: function(targetDir, changeUrl, fileId) { - 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 baf071af9bd..a9b6a1ac1c8 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -1338,6 +1338,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); |