Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/files/lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ private function redirectToFile(int $fileId) {
} else {
// set parent path as dir
$params['dir'] = $baseFolder->getRelativePath($node->getParent()->getPath());
// open the file by default (opening the viewer)
$params['openfile'] = 'true';
}
return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.indexViewFileid', $params));
}
Expand Down
7 changes: 5 additions & 2 deletions apps/files/src/composables/useRouteParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
)

/**
Expand All @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.