aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/components/FileEntryMixin.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/components/FileEntryMixin.ts')
-rw-r--r--apps/files/src/components/FileEntryMixin.ts30
1 files changed, 18 insertions, 12 deletions
diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts
index f2a6f89cf22..73c6ce19387 100644
--- a/apps/files/src/components/FileEntryMixin.ts
+++ b/apps/files/src/components/FileEntryMixin.ts
@@ -10,6 +10,7 @@ import { showError } from '@nextcloud/dialogs'
import { FileType, Permission, Folder, File as NcFile, NodeStatus, Node, getFileActions } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
+import { isPublicShare } from '@nextcloud/sharing/public'
import { vOnClickOutside } from '@vueuse/components'
import { extname } from 'path'
import Vue, { defineComponent } from 'vue'
@@ -281,21 +282,26 @@ export default defineComponent({
}
// if ctrl+click or middle mouse button, open in new tab
- if (event.ctrlKey || event.metaKey || event.button === 1) {
- event.preventDefault()
- window.open(generateUrl('/f/{fileId}', { fileId: this.fileid }))
- return false
- }
-
- if (this.defaultFileAction) {
+ // also if there is no default action use this as a fallback
+ const metaKeyPressed = event.ctrlKey || event.metaKey || event.button === 1
+ if (metaKeyPressed || !this.defaultFileAction) {
event.preventDefault()
event.stopPropagation()
- // Execute the first default action if any
- this.defaultFileAction.exec(this.source, this.currentView, this.currentDir)
- } else {
- // fallback to open in current tab
- window.open(generateUrl('/f/{fileId}', { fileId: this.fileid }), '_self')
+ let url: string
+ if (isPublicShare()) {
+ url = this.source.encodedSource
+ } else {
+ url = generateUrl('/f/{fileId}', { fileId: this.fileid })
+ }
+ window.open(url, metaKeyPressed ? '_self' : undefined)
+ return
}
+
+ // every special case handled so just execute the default action
+ event.preventDefault()
+ event.stopPropagation()
+ // Execute the first default action if any
+ this.defaultFileAction.exec(this.source, this.currentView, this.currentDir)
},
openDetailsIfAvailable(event) {