Match for /../
This commit is contained in:
parent
5b65591d84
commit
4ac9eaab03
|
@ -1404,7 +1404,7 @@
|
||||||
* @param {string} [fileId] file id
|
* @param {string} [fileId] file id
|
||||||
*/
|
*/
|
||||||
_setCurrentDir: function(targetDir, changeUrl, fileId) {
|
_setCurrentDir: function(targetDir, changeUrl, fileId) {
|
||||||
targetDir = targetDir.replace(/\\/g, '/').replace(/\.\.\//g, '');
|
targetDir = targetDir.replace(/\\/g, '/').replace(/\/\.\.\//g, '/');
|
||||||
var previousDir = this.getCurrentDirectory(),
|
var previousDir = this.getCurrentDirectory(),
|
||||||
baseDir = OC.basename(targetDir);
|
baseDir = OC.basename(targetDir);
|
||||||
|
|
||||||
|
|
|
@ -1338,6 +1338,10 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
fileList.changeDirectory('/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../');
|
fileList.changeDirectory('/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../');
|
||||||
expect(fileList.getCurrentDirectory()).toEqual('/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() {
|
it('switches to root dir when current directory does not exist', function() {
|
||||||
fileList.changeDirectory('/unexist');
|
fileList.changeDirectory('/unexist');
|
||||||
deferredList.reject(404);
|
deferredList.reject(404);
|
||||||
|
|
Loading…
Reference in New Issue