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