]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files): `openfile` is set on the query not as a param
authorFerdinand Thiessen <opensource@fthiessen.de>
Sat, 3 Aug 2024 11:52:12 +0000 (13:52 +0200)
committerFerdinand Thiessen <opensource@fthiessen.de>
Sat, 3 Aug 2024 11:52:12 +0000 (13:52 +0200)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/files/src/composables/useRouteParameters.ts

index 931b6eeefb29a66ca159b319c37dd20bedbcf1ab..abf14614fb735f87d468b254ccc8c8ff34ac79d2 100644 (file)
@@ -18,7 +18,7 @@ export function useRouteParameters() {
        const directory = computed<string>(
                () => String(route.query.dir || '/')
                        // Remove any trailing slash but leave root slash
-                       .replace(/^(.+)\/$/, '$1')
+                       .replace(/^(.+)\/$/, '$1'),
        )
 
        /**
@@ -32,7 +32,10 @@ export function useRouteParameters() {
        /**
         * State of `openFile` route param
         */
-       const openFile = computed<boolean>(() => 'openFile' in route.params && route.params.openFile.toLocaleLowerCase() !== 'false')
+       const openFile = computed<boolean>(
+               // if `openfile` is set it is considered truthy, but allow to explicitly set it to 'false'
+               () => 'openfile' in route.query && (typeof route.query.openfile !== 'string' || route.query.openfile.toLocaleLowerCase() !== 'false'),
+       )
 
        return {
                /** Path of currently open directory */