Merge branch 'master' into DVDAndroid-patch-1

This commit is contained in:
Oleg Lobanov 2020-08-05 10:41:39 +02:00 committed by GitHub
commit 08c3b15da7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

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

View File

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