Skip to content

Commit

Permalink
fix: Fix navigation to folder
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <chrng8@gmail.com>
(cherry picked from commit 3647a0a)
  • Loading branch information
Pytal committed Apr 4, 2024
1 parent b673ffd commit 289ed65
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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

0 comments on commit 289ed65

Please sign in to comment.