Skip to content
Permalink
Browse files

Filter out %0A from paths

  • Loading branch information...
nickvergessen committed Sep 1, 2016
1 parent e6c8c33 commit ed0f0db5fa0aff04594cb0f973ae4c22b17a175a
Showing with 8 additions and 2 deletions.
  1. +6 −1 apps/files/js/filelist.js
  2. +2 −1 apps/files/tests/js/filelistSpec.js
@@ -1400,14 +1400,19 @@
return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
},

/**
* @param {string} path
* @returns {boolean}
*/
_isValidPath: function(path) {
var sections = path.split('/');
for (var i = 0; i < sections.length; i++) {
if (sections[i] === '..') {
return false;
}
}
return true;

return path.toLowerCase().indexOf(decodeURI('%0a')) === -1;
},

/**
@@ -1379,9 +1379,10 @@ describe('OCA.Files.FileList tests', function() {
'/abc/..',
'/abc/../',
'/../abc/',
'/foo%0Abar/',
'/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../'
], function(path) {
fileList.changeDirectory(path);
fileList.changeDirectory(decodeURI(path));
expect(fileList.getCurrentDirectory()).toEqual('/');
});
});

0 comments on commit ed0f0db

Please sign in to comment.
You can’t perform that action at this time.