apply backslash fix to _setCurrentDir

This commit is contained in:
Thomas Müller 2015-02-19 17:12:29 +01:00
parent b848062d88
commit b7ff0d44d8
2 changed files with 6 additions and 1 deletions

View File

@ -1009,6 +1009,7 @@
* @param changeUrl true to also update the URL, false otherwise (default)
*/
_setCurrentDir: function(targetDir, changeUrl) {
targetDir = targetDir.replace(/\\/g, '/');
var previousDir = this.getCurrentDirectory(),
baseDir = OC.basename(targetDir);

View File

@ -1221,7 +1221,7 @@ describe('OCA.Files.FileList tests', function() {
"Content-Type": "application/json"
},
JSON.stringify(data)
]);
]);
});
it('fetches file list from server and renders it when reload() is called', function() {
fileList.reload();
@ -1242,6 +1242,10 @@ describe('OCA.Files.FileList tests', function() {
expect(OC.parseQueryString(query)).toEqual({'dir': '/anothersubdir', sort: 'name', sortdirection: 'asc'});
fakeServer.respond();
});
it('converts backslashes to slashes when calling changeDirectory()', function() {
fileList.changeDirectory('/another\\subdir');
expect(fileList.getCurrentDirectory()).toEqual('/another/subdir');
});
it('switches to root dir when current directory does not exist', function() {
fakeServer.respondWith(/\/index\.php\/apps\/files\/ajax\/list.php\?dir=%2funexist/, [
404, {