From 17cc6becd2560b33a9e85d3e4a3e2ae370acdeb0 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 13 Jul 2021 11:31:59 +0200 Subject: [PATCH] Ensure breadcrumbs and hash are correctly updated on folder navigation --- src/js/filemanager.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/js/filemanager.js b/src/js/filemanager.js index a7c545c24..c3db87ccf 100644 --- a/src/js/filemanager.js +++ b/src/js/filemanager.js @@ -390,7 +390,6 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl }); $scope.entries = result.entries; - $scope.cwdParts = $scope.cwd.split('/').filter(function (p) { return !!p; }).map(function (p, i) { return { name: decodeURIComponent(p), path: $scope.cwd.split('/').slice(0, i+1).join('/') }; }); $scope.busy = false; }); @@ -544,7 +543,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl }; $scope.goDirectoryUp = function () { - openPath($scope.cwd + '/..'); + location.hash = sanitize($scope.cwd + '/..'); }; $scope.changeDirectory = function (path) { @@ -1015,7 +1014,10 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl // now mark the Client to be ready Client.setReady(); - openPath(window.location.hash.slice(1)); + var hashPath = window.location.hash.slice(1); + $scope.cwdParts = hashPath.split('/').filter(function (p) { return !!p; }).map(function (p, i) { return { name: decodeURIComponent(p), path: hashPath.split('/').slice(0, i+1).join('/') }; }); + + openPath(hashPath); $scope.initialized = true; }); @@ -1043,7 +1045,10 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl $scope.mediaViewer.close(); $scope.textEditor.close(); - openPath(window.location.hash.slice(1)); + var hashPath = window.location.hash.slice(1); + $scope.cwdParts = hashPath.split('/').filter(function (p) { return !!p; }).map(function (p, i) { return { name: decodeURIComponent(p), path: hashPath.split('/').slice(0, i+1).join('/') }; }); + + openPath(hashPath); }); });