Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: Fix navigation to folder
Signed-off-by: Christopher Ng <[email protected]>
(cherry picked from commit 3647a0a)
  • Loading branch information
Pytal committed Apr 4, 2024
commit 289ed65d4e3706ceb4426fd9e6102d8a6b37841c
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@nextcloud/axios": "^2.4.0",
"@nextcloud/files": "^3.0.0",
"@nextcloud/l10n": "^2.2.0",
"@nextcloud/paths": "^2.1.0",
"@nextcloud/router": "^3.0.0",
"@nextcloud/vue": "^8.9.1",
"lodash": "^4.17.21",
Expand Down
10 changes: 8 additions & 2 deletions src/components/RecommendedFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<script>
import { translate as t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
import { joinPaths } from '@nextcloud/paths'

export default {
name: 'RecommendedFile',
Expand Down Expand Up @@ -100,6 +101,9 @@ export default {
path() {
return (this.directory === '/' ? '' : this.directory) + '/' + this.name
},
isFolder() {
return this.mimeType === 'httpd/unix-directory'
},
},
mounted() {
if (this.hasPreview) {
Expand Down Expand Up @@ -128,12 +132,14 @@ export default {

// Navigate to the file if the file router is available
if (window.OCP?.Files?.Router) {
const dir = this.isFolder ? joinPaths(this.directory, this.name) : this.directory
const fileid = this.isFolder ? null : this.id
window.OCP.Files.Router.goToRoute(
// use default route
null,
// recommendations is only enabled on files
{ view: 'files', fileid: this.id },
{ dir: this.directory },
{ view: 'files', fileid },
{ dir },
)
return
}
Expand Down