summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-07-06 12:44:03 +0200
committerGitHub <noreply@github.com>2016-07-06 12:44:03 +0200
commitcf6fe95cbf2d031ecd1fba00280d6c3c428d1877 (patch)
treef8ae65b1ee71d379863b5acb1891fd9c8dd805a0 /apps
parent1f9d72853859c1f4f60be243d11cc007420fad9e (diff)
parent4acb06923d633bba9151237b0f0a88dcf99da7e6 (diff)
downloadnextcloud-server-cf6fe95cbf2d031ecd1fba00280d6c3c428d1877.tar.gz
nextcloud-server-cf6fe95cbf2d031ecd1fba00280d6c3c428d1877.zip
Merge pull request #25325 from owncloud/filelist-prependslash
Filelist change dir auto-prepend slash
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/filelist.js5
-rw-r--r--apps/files/tests/js/filelistSpec.js6
2 files changed, 10 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 7a7d26eed7c..4f4c833a5f3 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -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
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index d8d3057ec3e..fdf5006857e 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -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;