fix: ipv6 issues with encodeURI

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2022-01-18 20:47:46 +01:00
parent be2efac9fd
commit 56d61ce6ae
No known key found for this signature in database
GPG Key ID: 5D3A5823133D2246
5 changed files with 8 additions and 8 deletions

View File

@ -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()}`
}
}
@ -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()}`
}
}

View File

@ -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}`
}
}
@ -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

View File

@ -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)
}

View File

@ -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}`
}
}
}
@ -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}`
}
}
}

View File

@ -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 ''