diff options
Diffstat (limited to 'src/nodes/ImageView.vue')
-rw-r--r-- | src/nodes/ImageView.vue | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/nodes/ImageView.vue b/src/nodes/ImageView.vue index f3d230de2..df8f58b60 100644 --- a/src/nodes/ImageView.vue +++ b/src/nodes/ImageView.vue @@ -104,8 +104,8 @@ export default { davUrl() { if (getCurrentUser()) { const uid = getCurrentUser().uid - const encoded = encodeURI(path.normalize(this.filePath)) - return generateRemoteUrl(`dav/files/${uid}/${encoded}`) + const encoded = encodeURI(this.filePath) + return generateRemoteUrl(`dav/files/${uid}${encoded}`) } else { return generateUrl('/s/{token}/download?path={dirname}&files={basename}', { @@ -116,7 +116,7 @@ export default { } }, imageUrl() { - if (this.src.startsWith('http://') || this.src.startsWith('https://')) { + if (this.isRemoteUrl || this.isPreviewUrl) { return this.src } if (this.hasPreview && this.mime !== 'image/gif') { @@ -124,6 +124,14 @@ export default { } return this.davUrl }, + isRemoteUrl() { + return this.src.startsWith('http://') + || this.src.startsWith('https://') + }, + isPreviewUrl() { + return this.src.match(/^(\/index.php)?\/core\/preview/) + || this.src.match(/^(\/index.php)?\/apps\/files_sharing\/publicpreview\//) + }, basename() { return decodeURI(this.src.split('?')[0]) }, @@ -141,11 +149,6 @@ export default { return getQueryVariable(this.src, 'hasPreview') === 'true' }, previewUrl() { - if (this.src.match(/^(\/index.php)?\/core\/preview/) - || this.src.match(/^(\/index.php)?\/apps\/files_sharing\/publicpreview\//) - ) { - return this.src - } const fileQuery = (this.fileId) ? `?fileId=${this.fileId}&file=${encodeURIComponent(this.filePath)}` : `?file=${encodeURIComponent(this.filePath)}` |