From a49d523c5bddf4931f4e54c133767989b5cfaf06 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Mon, 16 Sep 2024 14:41:16 +0200 Subject: [PATCH] fix: Only remove openfile from route when closing the viewer Signed-off-by: Louis Chemineau --- src/services/FilesActionHandler.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/services/FilesActionHandler.js b/src/services/FilesActionHandler.js index 429772278..05ecdfdd7 100644 --- a/src/services/FilesActionHandler.js +++ b/src/services/FilesActionHandler.js @@ -28,16 +28,11 @@ export default function(node, view, dir) { // replace potential leading double slashes const path = `${node.dirname}/${node.basename}`.replace(/^\/\//, '/') - const oldRoute = [ - window.OCP.Files.Router.name, - { ...window.OCP.Files.Router.params }, - { ...window.OCP.Files.Router.query }, - true, - ] const onClose = () => { // This can sometime be called with the openfile set to true already. But we don't want to keep openfile when closing the viewer. - delete oldRoute[2].openfile - window.OCP.Files.Router.goToRoute(...oldRoute) + const newQuery = { ...window.OCP.Files.Router.query } + delete newQuery.openfile + window.OCP.Files.Router.goToRoute(null, window.OCP.Files.Router.params, newQuery) } pushToHistory(node, view, dir) OCA.Viewer.open({ path, onPrev: pushToHistory, onNext: pushToHistory, onClose })