aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-06-04 01:26:28 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-09-06 03:38:47 +0200
commit819f5cea9bfaded7fe0d177eefa13e5e1e30a552 (patch)
treefb35591e4ad4feebd6cb45a594668f71574d06c5 /apps
parent767e87a466c62f222eb6f24042aded954b152255 (diff)
downloadnextcloud-server-819f5cea9bfaded7fe0d177eefa13e5e1e30a552.tar.gz
nextcloud-server-819f5cea9bfaded7fe0d177eefa13e5e1e30a552.zip
fix(files): Fix file previews for public shares
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/src/components/FileEntry/FileEntryPreview.vue24
1 files changed, 17 insertions, 7 deletions
diff --git a/apps/files/src/components/FileEntry/FileEntryPreview.vue b/apps/files/src/components/FileEntry/FileEntryPreview.vue
index 071a47ef3d9..2d5844f851f 100644
--- a/apps/files/src/components/FileEntry/FileEntryPreview.vue
+++ b/apps/files/src/components/FileEntry/FileEntryPreview.vue
@@ -49,9 +49,10 @@ import type { PropType } from 'vue'
import type { UserConfig } from '../../types.ts'
import { Node, FileType } from '@nextcloud/files'
-import { generateUrl } from '@nextcloud/router'
import { translate as t } from '@nextcloud/l10n'
+import { generateUrl } from '@nextcloud/router'
import { ShareType } from '@nextcloud/sharing'
+import { getSharingToken, isPublicShare } from '@nextcloud/sharing/public'
import { decode } from 'blurhash'
import { defineComponent } from 'vue'
@@ -107,8 +108,14 @@ export default defineComponent({
setup() {
const userConfigStore = useUserConfigStore()
+ const isPublic = isPublicShare()
+ const publicSharingToken = getSharingToken()
+
return {
userConfigStore,
+
+ isPublic,
+ publicSharingToken,
}
},
@@ -120,9 +127,6 @@ export default defineComponent({
},
computed: {
- fileid() {
- return this.source?.fileid?.toString?.()
- },
isFavorite(): boolean {
return this.source.attributes.favorite === 1
},
@@ -145,9 +149,15 @@ export default defineComponent({
try {
const previewUrl = this.source.attributes.previewUrl
- || generateUrl('/core/preview?fileId={fileid}', {
- fileid: this.fileid,
- })
+ || (this.isPublic
+ ? generateUrl('/apps/files_sharing/publicpreview/{token}?file={file}', {
+ token: this.publicSharingToken,
+ file: this.source.path,
+ })
+ : generateUrl('/core/preview?fileId={fileid}', {
+ fileid: String(this.source.fileid),
+ })
+ )
const url = new URL(window.location.origin + previewUrl)
// Request tiny previews