fix: download drive files via temporary link (#5644)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-05-23 00:03:28 +07:00 committed by GitHub
parent 2c89008374
commit fe2756aabf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,8 +50,13 @@ async function EditDrive (drive: Drive): Promise<void> {
async function DownloadFile (doc: File | File[]): Promise<void> {
const files = Array.isArray(doc) ? doc : [doc]
for (const file of files) {
const url = getFileUrl(file.file, 'full', file.name)
window.open(url, '_blank')
const href = getFileUrl(file.file, 'full', file.name)
const link = document.createElement('a')
link.style.display = 'none'
link.target = '_blank'
link.href = href
link.download = file.name
link.click()
}
}