]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not call changeDirectory() when no dir set on breadcrumb
authorVincent Petry <pvince81@owncloud.com>
Fri, 4 Oct 2013 15:49:42 +0000 (17:49 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 4 Oct 2013 15:49:42 +0000 (17:49 +0200)
Some apps like the files_trashbin app do not set a directory on its
"home" breadcrumb link.

This fix makes sure that the click event doesn't do anything in that
case and lets the browser open the link.

This fixes the "home" icon in the trashbin app which now correctly
reopens the files app.

apps/files/js/files.js

index 899bc6469e503a74bf8b99a2bc7381ca5e169878..09f5d6f114c431361aa2a8305481ffc0b5d25fc0 100644 (file)
@@ -701,7 +701,10 @@ function checkTrashStatus() {
 }
 
 function onClickBreadcrumb(e){
-       var $el = $(e.target).closest('.crumb');
-       e.preventDefault();
-       FileList.changeDirectory(decodeURIComponent($el.data('dir')));
+       var $el = $(e.target).closest('.crumb'),
+               $targetDir = $el.data('dir');
+       if ($targetDir !== undefined){
+               e.preventDefault();
+               FileList.changeDirectory(decodeURIComponent($targetDir));
+       }
 }