Properly handle searchParams

This should avoid the pitfalls of trying to manually decide to attach inline=true with a ? or a &.
This commit is contained in:
Andrew Kennedy 2021-08-04 02:28:39 -07:00 committed by GitHub
parent 73932a666d
commit 70991aebaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,7 @@
</a> </a>
<a <a
target="_blank" target="_blank"
:href="link + '&inline=true'" :href="inlineLink"
class="button button--flat" class="button button--flat"
v-if="!req.isDir" v-if="!req.isDir"
> >
@ -239,6 +239,10 @@ export default {
const path = this.$route.path.split("/").splice(2).join("/"); const path = this.$route.path.split("/").splice(2).join("/");
return `${baseURL}/api/public/dl/${path}${queryArg}`; return `${baseURL}/api/public/dl/${path}${queryArg}`;
}, },
inlineLink: function () {
url = new URL(this.link);
url.searchParams.set('inline', 'true');
return url.href;
fullLink: function () { fullLink: function () {
return window.location.origin + this.link; return window.location.origin + this.link;
}, },