Skip to content

Commit

Permalink
fix: ipv6 issues with encodeURI
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Jan 18, 2022
1 parent be2efac commit 56d61ce
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/panels/GcodefilesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
)
if (thumbnail && 'relative_path' in thumbnail) {
return encodeURI(`${this.apiUrl}/server/files/${this.currentPath}/${thumbnail.relative_path}?timestamp=${item.modified.getTime()}`)
return `${this.apiUrl}/server/files/${encodeURI(this.currentPath)}/${encodeURI(thumbnail.relative_path)}?timestamp=${item.modified.getTime()}`
}
}
Expand All @@ -937,7 +937,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
const thumbnail = item.thumbnails.find(thumb => thumb.width >= thumbnailBigMin)
if (thumbnail && 'relative_path' in thumbnail) {
return encodeURI(`${this.apiUrl}/server/files/${this.currentPath}/${thumbnail.relative_path}?timestamp=${item.modified.getTime()}`)
return `${this.apiUrl}/server/files/${encodeURI(this.currentPath)}/${encodeURI(thumbnail.relative_path)}?timestamp=${item.modified.getTime()}`
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/HistoryListPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
}
if (thumbnail && 'relative_path' in thumbnail) {
return encodeURI(`${this.apiUrl}/server/files/gcodes/${relative_url+thumbnail.relative_path}?timestamp=${item.metadata.modified}`)
return `${this.apiUrl}/server/files/gcodes/${encodeURI(relative_url+thumbnail.relative_path)}?timestamp=${item.metadata.modified}`
}
}
Expand All @@ -617,7 +617,7 @@ export default class HistoryListPanel extends Mixins(BaseMixin) {
}
if (thumbnail && 'relative_path' in thumbnail)
return encodeURI(`${this.apiUrl}/server/files/gcodes/${relative_url+thumbnail.relative_path}?timestamp=${item.metadata.modified}`)
return `${this.apiUrl}/server/files/gcodes/${encodeURI(relative_url+thumbnail.relative_path)}?timestamp=${item.metadata.modified}`
}
return false
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Machine/ConfigFilesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
downloadFile() {
const filename = (this.absolutePath+'/'+this.contextMenu.item.filename)
const href = encodeURI(`${this.apiUrl}/server/files${filename}`)
const href = `${this.apiUrl}/server/files${encodeURI(filename)}`
window.open(href)
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/StatusPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {
}
if (thumbnail && 'relative_path' in thumbnail) {
return encodeURI(`${this.apiUrl}/server/files/gcodes/${relative_url+thumbnail.relative_path}?timestamp=${this.current_file.modified}`)
return `${this.apiUrl}/server/files/gcodes/${encodeURI(relative_url+thumbnail.relative_path)}?timestamp=${this.current_file.modified}`
}
}
}
Expand All @@ -536,7 +536,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {
}
if (thumbnail && 'relative_path' in thumbnail) {
return encodeURI(`${this.apiUrl}/server/files/gcodes/${relative_url+thumbnail.relative_path}?timestamp=${this.current_file.modified}`)
return `${this.apiUrl}/server/files/gcodes/${encodeURI(relative_url+thumbnail.relative_path)}?timestamp=${this.current_file.modified}`
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Timelapse/TimelapseFilesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 encodeURI(`${this.apiUrl}/server/files/${this.currentPath}/${preview.filename}?timestamp=${preview.modified.getTime()}`)
return `${this.apiUrl}/server/files/${encodeURI(this.currentPath)}/${encodeURI(preview.filename)}?timestamp=${preview.modified.getTime()}`
}
return ''
Expand Down

0 comments on commit 56d61ce

Please sign in to comment.