Filelist change dir auto-prepend slash
Prepend a slash to directories in case it was missing since many places assume that it's there.
This commit is contained in:
parent
2d2d2267f7
commit
4acb06923d
|
@ -513,7 +513,7 @@
|
|||
* Event handler for when the URL changed
|
||||
*/
|
||||
_onUrlChanged: function(e) {
|
||||
if (e && e.dir) {
|
||||
if (e && _.isString(e.dir)) {
|
||||
this.changeDirectory(e.dir, false, true);
|
||||
}
|
||||
},
|
||||
|
@ -1415,6 +1415,9 @@
|
|||
this.setPageTitle();
|
||||
}
|
||||
|
||||
if (targetDir.length > 0 && targetDir[0] !== '/') {
|
||||
targetDir = '/' + targetDir;
|
||||
}
|
||||
this._currentDirectory = targetDir;
|
||||
|
||||
// legacy stuff
|
||||
|
|
|
@ -1391,6 +1391,12 @@ describe('OCA.Files.FileList tests', function() {
|
|||
setDirSpy.restore();
|
||||
getFolderContentsStub.restore();
|
||||
});
|
||||
it('prepends a slash to directory if none was given', function() {
|
||||
fileList.changeDirectory('');
|
||||
expect(fileList.getCurrentDirectory()).toEqual('/');
|
||||
fileList.changeDirectory('noslash');
|
||||
expect(fileList.getCurrentDirectory()).toEqual('/noslash');
|
||||
});
|
||||
});
|
||||
describe('breadcrumb events', function() {
|
||||
var deferredList;
|
||||
|
|
Loading…
Reference in New Issue