Skip to content

Commit

Permalink
fix: escape urls also escape / in the url
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Dec 1, 2021
1 parent 43674bf commit 9bcbfa4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/panels/GcodefilesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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+'/'+encodeURIComponent(thumbnail.relative_path)+'?timestamp='+item.modified.getTime()
if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+this.currentPath+'/'+encodeURI(thumbnail.relative_path)+'?timestamp='+item.modified.getTime()
}
return ''
Expand All @@ -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+'/'+encodeURIComponent(thumbnail.relative_path)+'?timestamp='+item.modified.getTime()
if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+this.currentPath+'/'+encodeURI(thumbnail.relative_path)+'?timestamp='+item.modified.getTime()
}
return ''
Expand Down Expand Up @@ -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/' + encodeURIComponent(filename)
const href = this.apiUrl + '/server/files/' + encodeURI(filename)
window.open(href)
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/JobqueuePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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+'/'+encodeURIComponent(thumbnail.relative_path)+'?timestamp='+item.metadata?.modified.getTime()
if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+path+'/'+encodeURI(thumbnail.relative_path)+'?timestamp='+item.metadata?.modified.getTime()
}
return ''
Expand All @@ -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+'/'+encodeURIComponent(thumbnail.relative_path)+'?timestamp='+item.metadata?.modified.getTime()
if (thumbnail && 'relative_path' in thumbnail) return this.apiUrl+'/server/files/'+path+'/'+encodeURI(thumbnail.relative_path)+'?timestamp='+item.metadata?.modified.getTime()
}
return ''
Expand Down

0 comments on commit 9bcbfa4

Please sign in to comment.