fix(files): do not execute the default action on folders

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ 2023-04-21 15:58:40 +02:00
parent a5a5c09f58
commit 51f2f56b4b
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF

View file

@ -262,6 +262,15 @@ export default Vue.extend({
},
linkTo() {
if (this.source.type === 'folder') {
const to = { ...this.$route, query: { dir: join(this.dir, this.source.basename) } }
return {
is: 'router-link',
title: this.t('files', 'Open folder {name}', { name: this.displayName }),
to,
}
}
if (this.enabledDefaultActions.length > 0) {
const action = this.enabledDefaultActions[0]
const displayName = action.displayName([this.source], this.currentView)
@ -271,14 +280,6 @@ export default Vue.extend({
}
}
if (this.source.type === 'folder') {
const to = { ...this.$route, query: { dir: join(this.dir, this.source.basename) } }
return {
is: 'router-link',
title: this.t('files', 'Open folder {name}', { name: this.displayName }),
to,
}
}
return {
href: this.source.source,
// TODO: Use first action title ?
@ -525,6 +526,11 @@ export default Vue.extend({
}
},
execDefaultAction(event) {
// Do not execute the default action on the folder, navigate instead
if (this.source.type === 'folder') {
return
}
if (this.enabledDefaultActions.length > 0) {
event.preventDefault()
event.stopPropagation()