1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-01-25 00:49:35 +00:00

Properly build download link in the DownloadLink frontend component

This commit is contained in:
Davide Silvestri 2024-10-14 16:32:10 +02:00
parent 3438c1074f
commit 43e10a9300
2 changed files with 14 additions and 6 deletions
changelog/entries/unreleased/refactor
web-frontend/modules/core/components

View file

@ -0,0 +1,7 @@
{
"type": "refactor",
"message": "Properly build the download link for the DownloadLink frontend component.",
"issue_number": null,
"bullet_points": [],
"created_at": "2024-10-14"
}

View file

@ -1,10 +1,5 @@
<template>
<a
v-if="!downloadXHR"
:href="`${url}?dl=${filename}`"
target="_blank"
:download="filename"
>
<a v-if="!downloadXHR" :href="href" target="_blank" :download="filename">
<slot></slot>
</a>
<a
@ -48,6 +43,12 @@ export default {
downloadXHR() {
return this.$config.DOWNLOAD_FILE_VIA_XHR === '1'
},
href() {
// Add the filename to the query string
const url = new URL(this.url)
url.searchParams.set('dl', this.filename)
return url.toString()
},
},
methods: {
async download() {