Skip to content

Commit

Permalink
fix: Only remove openfile from route when closing the viewer
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Sep 16, 2024
1 parent c65f850 commit a10a3e1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/services/FilesActionHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down

0 comments on commit a10a3e1

Please sign in to comment.