From a75b133dea142fcea03858141603f141d09ae85c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 28 Nov 2021 12:19:07 +0100 Subject: [PATCH] fix: special cases in thumbnail urls fixed #390 Signed-off-by: Stefan Dej --- src/components/panels/GcodefilesPanel.vue | 6 +++--- src/components/panels/JobqueuePanel.vue | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/panels/GcodefilesPanel.vue b/src/components/panels/GcodefilesPanel.vue index 81d265e7..c452f99b 100644 --- a/src/components/panels/GcodefilesPanel.vue +++ b/src/components/panels/GcodefilesPanel.vue @@ -900,7 +900,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) { thumb.height >= thumbnailSmallMin && thumb.height <= thumbnailSmallMax ) - if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+this.currentPath+'/'+thumbnail.relative_path+'?timestamp='+item.modified.getTime() + if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+this.currentPath+'/'+encodeURIComponent(thumbnail.relative_path)+'?timestamp='+item.modified.getTime() } return '' @@ -910,7 +910,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) { if (item.thumbnails?.length) { const thumbnail = item.thumbnails.find(thumb => thumb.width >= thumbnailBigMin) - if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+this.currentPath+'/'+thumbnail.relative_path+'?timestamp='+item.modified.getTime() + if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+this.currentPath+'/'+encodeURIComponent(thumbnail.relative_path)+'?timestamp='+item.modified.getTime() } return '' @@ -1014,7 +1014,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) { downloadFile() { const filename = (this.currentPath+'/'+this.contextMenu.item.filename) - const href = this.apiUrl + '/server/files/' + encodeURI(filename) + const href = this.apiUrl + '/server/files/' + encodeURIComponent(filename) window.open(href) } diff --git a/src/components/panels/JobqueuePanel.vue b/src/components/panels/JobqueuePanel.vue index 662b0f53..3b134b68 100644 --- a/src/components/panels/JobqueuePanel.vue +++ b/src/components/panels/JobqueuePanel.vue @@ -206,7 +206,7 @@ export default class JobqueuePanel extends Mixins(BaseMixin) { ) const path = item.filename.lastIndexOf('/') !== -1 ? 'gcodes/'+item.filename.slice(0, item.filename.lastIndexOf('/')) : 'gcodes' - if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+path+'/'+thumbnail.relative_path+'?timestamp='+item.metadata?.modified.getTime() + if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+path+'/'+encodeURIComponent(thumbnail.relative_path)+'?timestamp='+item.metadata?.modified.getTime() } return '' @@ -217,7 +217,7 @@ export default class JobqueuePanel extends Mixins(BaseMixin) { const thumbnail = item?.metadata?.thumbnails.find((thumb: any) => thumb.width >= thumbnailBigMin) const path = item.filename.lastIndexOf('/') !== -1 ? 'gcodes/'+item.filename.slice(0, item.filename.lastIndexOf('/')) : 'gcodes' - if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+path+'/'+thumbnail.relative_path+'?timestamp='+item.metadata?.modified.getTime() + if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+path+'/'+encodeURIComponent(thumbnail.relative_path)+'?timestamp='+item.metadata?.modified.getTime() } return ''