Skip to content

Commit

Permalink
fix: image rendering via public previews
Browse files Browse the repository at this point in the history
Public Preview only has one route - it does not make use of the fileId.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Apr 27, 2022
1 parent 3583de4 commit 13a05b2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions package/nodes/ImageView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,19 @@ export default {
|| this.src.startsWith('text://')
},
previewUrl() {
const fileQuery = (this.imageFileId)
? `?fileId=${this.imageFileId}&file=${encodeURIComponent(this.imagePath)}`
: `.png?file=${encodeURIComponent(this.imagePath)}`
const fileQuery = `file=${encodeURIComponent(this.imagePath)}`
const query = fileQuery + '&x=1024&y=1024&a=true'

if (getCurrentUser() && this.imageFileId) {
return generateUrl(`/core/preview?fileId=${this.imageFileId}&${query}`)
}
if (getCurrentUser()) {
return generateUrl('/core/preview') + query
} else {
return generateUrl(`/apps/files_sharing/publicpreview/${this.token}${query}`)
return generateUrl(`/core/preview.png?${query}`)
}
if (this.token) {
return generateUrl(`/apps/files_sharing/publicpreview/${this.token}?${query}`)
}
console.error('No way to authenticate image retrival - need to be logged in or provide a token')
return ''
},
mime() {
return getQueryVariable(this.src, 'mimetype')
Expand Down

0 comments on commit 13a05b2

Please sign in to comment.