summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-07-01 15:00:31 +0200
committerLukas Reschke <lukas@owncloud.com>2016-07-01 15:00:31 +0200
commit8aa0832bd449c44ec300da4189bd8ed4e036140c (patch)
treeba775321c6e5fa37375cdab1e57648f28ebe1885 /apps
parent2da43e3751576bbc838f238a09955c4dcdebee8e (diff)
downloadnextcloud-server-8aa0832bd449c44ec300da4189bd8ed4e036140c.tar.gz
nextcloud-server-8aa0832bd449c44ec300da4189bd8ed4e036140c.zip
Match for /../
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--apps/files/tests/js/filelistSpec.js4
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);