Filter out %0A from paths
This commit is contained in:
parent
a98e66ddb0
commit
778ae8abd5
|
@ -1327,6 +1327,10 @@
|
||||||
return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
|
return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
_isValidPath: function(path) {
|
_isValidPath: function(path) {
|
||||||
var sections = path.split('/');
|
var sections = path.split('/');
|
||||||
for (var i = 0; i < sections.length; i++) {
|
for (var i = 0; i < sections.length; i++) {
|
||||||
|
@ -1334,7 +1338,8 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
return path.toLowerCase().indexOf(decodeURI('%0a')) === -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1333,9 +1333,10 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
'/abc/..',
|
'/abc/..',
|
||||||
'/abc/../',
|
'/abc/../',
|
||||||
'/../abc/',
|
'/../abc/',
|
||||||
|
'/foo%0Abar/',
|
||||||
'/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../'
|
'/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../'
|
||||||
], function(path) {
|
], function(path) {
|
||||||
fileList.changeDirectory(path);
|
fileList.changeDirectory(decodeURI(path));
|
||||||
expect(fileList.getCurrentDirectory()).toEqual('/');
|
expect(fileList.getCurrentDirectory()).toEqual('/');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue