Merge pull request #25325 from owncloud/filelist-prependslash

Filelist change dir auto-prepend slash
This commit is contained in:
Vincent Petry 2016-07-06 12:44:03 +02:00 committed by GitHub
commit cf6fe95cbf
2 changed files with 10 additions and 1 deletions

View File

@ -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);
}
},
@ -1429,6 +1429,9 @@
this.setPageTitle();
}
if (targetDir.length > 0 && targetDir[0] !== '/') {
targetDir = '/' + targetDir;
}
this._currentDirectory = targetDir;
// legacy stuff

View File

@ -1416,6 +1416,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;