Skip to content
Permalink
Browse files Browse the repository at this point in the history
Match for /../
  • Loading branch information
LukasReschke committed Jul 1, 2016
1 parent 2da43e3 commit 8aa0832
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/files/js/filelist.js
Expand Up @@ -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);

Expand Down
4 changes: 4 additions & 0 deletions apps/files/tests/js/filelistSpec.js
Expand Up @@ -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);
Expand Down

0 comments on commit 8aa0832

Please sign in to comment.