diff --git a/src/components/panels/GcodefilesPanel.vue b/src/components/panels/GcodefilesPanel.vue index d894ea61..0bba2583 100644 --- a/src/components/panels/GcodefilesPanel.vue +++ b/src/components/panels/GcodefilesPanel.vue @@ -924,7 +924,9 @@ 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+'/'+encodeURI(thumbnail.relative_path)+'?timestamp='+item.modified.getTime() + if (thumbnail && 'relative_path' in thumbnail) { + return encodeURI(`${this.apiUrl}/server/files/${this.currentPath}/${thumbnail.relative_path}?timestamp=${item.modified.getTime()}`) + } } return '' @@ -934,7 +936,9 @@ 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+'/'+encodeURI(thumbnail.relative_path)+'?timestamp='+item.modified.getTime() + if (thumbnail && 'relative_path' in thumbnail) { + return encodeURI(`${this.apiUrl}/server/files/${this.currentPath}/${thumbnail.relative_path}?timestamp=${item.modified.getTime()}`) + } } return '' diff --git a/src/components/panels/HistoryListPanel.vue b/src/components/panels/HistoryListPanel.vue index a7d98d7c..dadf9253 100644 --- a/src/components/panels/HistoryListPanel.vue +++ b/src/components/panels/HistoryListPanel.vue @@ -595,8 +595,9 @@ export default class HistoryListPanel extends Mixins(BaseMixin) { relative_url = item.filename.substr(0, item.filename.lastIndexOf('/')+1) } - if (thumbnail && 'relative_path' in thumbnail) - return this.apiUrl+'/server/files/gcodes/'+relative_url+thumbnail.relative_path+'?timestamp='+item.metadata.modified + if (thumbnail && 'relative_path' in thumbnail) { + return encodeURI(`${this.apiUrl}/server/files/gcodes/${relative_url+thumbnail.relative_path}?timestamp=${item.metadata.modified}`) + } } return false @@ -616,7 +617,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) { } if (thumbnail && 'relative_path' in thumbnail) - return this.apiUrl+'/server/files/gcodes/'+relative_url+thumbnail.relative_path+'?timestamp='+item.metadata.modified + return encodeURI(`${this.apiUrl}/server/files/gcodes/${relative_url+thumbnail.relative_path}?timestamp=${item.metadata.modified}`) } return false diff --git a/src/components/panels/Machine/ConfigFilesPanel.vue b/src/components/panels/Machine/ConfigFilesPanel.vue index b77461a8..4f7905b1 100644 --- a/src/components/panels/Machine/ConfigFilesPanel.vue +++ b/src/components/panels/Machine/ConfigFilesPanel.vue @@ -657,7 +657,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) { downloadFile() { const filename = (this.absolutePath+'/'+this.contextMenu.item.filename) - const href = this.apiUrl + '/server/files' + filename + const href = encodeURI(`${this.apiUrl}/server/files${filename}`) window.open(href) } diff --git a/src/components/panels/StatusPanel.vue b/src/components/panels/StatusPanel.vue index dea2d238..3b29cb0e 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -513,8 +513,9 @@ export default class StatusPanel extends Mixins(BaseMixin) { relative_url = this.current_file.filename.substr(0, this.current_file.filename.lastIndexOf('/')+1) } - if (thumbnail && 'relative_path' in thumbnail) - return this.apiUrl+'/server/files/gcodes/'+relative_url+thumbnail.relative_path+'?timestamp='+this.current_file.modified + if (thumbnail && 'relative_path' in thumbnail) { + return encodeURI(`${this.apiUrl}/server/files/gcodes/${relative_url+thumbnail.relative_path}?timestamp=${this.current_file.modified}`) + } } } @@ -534,8 +535,9 @@ export default class StatusPanel extends Mixins(BaseMixin) { relative_url = this.current_file.filename.substr(0, this.current_file.filename.lastIndexOf('/')+1) } - if (thumbnail && 'relative_path' in thumbnail) - return this.apiUrl+'/server/files/gcodes/'+relative_url+thumbnail.relative_path+'?timestamp='+this.current_file.modified + if (thumbnail && 'relative_path' in thumbnail) { + return encodeURI(`${this.apiUrl}/server/files/gcodes/${relative_url+thumbnail.relative_path}?timestamp=${this.current_file.modified}`) + } } } diff --git a/src/components/panels/Timelapse/TimelapseFilesPanel.vue b/src/components/panels/Timelapse/TimelapseFilesPanel.vue index c723f2e5..8f744f68 100644 --- a/src/components/panels/Timelapse/TimelapseFilesPanel.vue +++ b/src/components/panels/Timelapse/TimelapseFilesPanel.vue @@ -443,7 +443,7 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) { const filename = item.filename.slice(0, item.filename.lastIndexOf('.')) const preview = this.files?.find((file) => file.filename === filename+'.jpg') if (preview) { - return this.apiUrl+'/server/files/'+this.currentPath+'/'+preview.filename+'?timestamp='+preview.modified.getTime() + return encodeURI(`${this.apiUrl}/server/files/${this.currentPath}/${preview.filename}?timestamp=${preview.modified.getTime()}`) } return '' @@ -457,7 +457,7 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) { else if (item.filename.endsWith('zip')) { this.downloadFile(item.filename) } else if (item.filename.endsWith('mp4')) { - this.videoDialogFilename = this.currentPath + '/' + item.filename + this.videoDialogFilename = encodeURI(`${this.currentPath}/${item.filename}`) this.boolVideoDialog = true } }