chore: fix preview of files with non-latin names (closes #1056)
parent
a2fb499a20
commit
5881bc9ab0
|
@ -99,13 +99,13 @@ export default {
|
||||||
return (this.nextLink !== '')
|
return (this.nextLink !== '')
|
||||||
},
|
},
|
||||||
download () {
|
download () {
|
||||||
return `${baseURL}/api/raw${escape(this.req.path)}?auth=${this.jwt}`
|
return `${baseURL}/api/raw${url.encodePath(this.req.path)}?auth=${this.jwt}`
|
||||||
},
|
},
|
||||||
previewUrl () {
|
previewUrl () {
|
||||||
if (this.req.type === 'image') {
|
if (this.req.type === 'image') {
|
||||||
return `${baseURL}/api/preview/big${escape(this.req.path)}?auth=${this.jwt}`
|
return `${baseURL}/api/preview/big${url.encodePath(this.req.path)}?auth=${this.jwt}`
|
||||||
}
|
}
|
||||||
return `${baseURL}/api/raw${escape(this.req.path)}?auth=${this.jwt}`
|
return `${baseURL}/api/raw${url.encodePath(this.req.path)}?auth=${this.jwt}`
|
||||||
},
|
},
|
||||||
raw () {
|
raw () {
|
||||||
return `${this.previewUrl}&inline=true`
|
return `${this.previewUrl}&inline=true`
|
||||||
|
|
|
@ -20,7 +20,12 @@ function encodeRFC5987ValueChars(str) {
|
||||||
replace(/%(?:7C|60|5E)/g, unescape);
|
replace(/%(?:7C|60|5E)/g, unescape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function encodePath(str) {
|
||||||
|
return str.split('/').map(v => encodeURIComponent(v)).join('/')
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
encodeRFC5987ValueChars: encodeRFC5987ValueChars,
|
encodeRFC5987ValueChars: encodeRFC5987ValueChars,
|
||||||
removeLastDir: removeLastDir
|
removeLastDir: removeLastDir,
|
||||||
|
encodePath: encodePath
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue