mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Move Library BibTeX export to a server-side endpoint (#36604)
* Move bulk bibtex download to a server-side streaming endpoint * Wrap download fetch errors in FetchError and parse the error body * Refactor library references download to use GET request and stream response * Remove MAX_DOWNLOAD_IDS limit from downloadIdsSchema and related test * fix merge conflict GitOrigin-RevId: dee2bae8bfb982cd1b79bbd21c9f1b90e8cff1a4
This commit is contained in:
committed by
Copybot
parent
f0cd4b737f
commit
a301363ece
@@ -1,11 +1,19 @@
|
||||
export function downloadFileContent(content: string, filename: string) {
|
||||
const blob = new Blob([content], { type: 'application/octet-stream' })
|
||||
const url = URL.createObjectURL(blob)
|
||||
clickDownloadLink(url, filename)
|
||||
setTimeout(() => URL.revokeObjectURL(url), 0)
|
||||
}
|
||||
|
||||
export function downloadFileFromUrl(url: string, filename: string) {
|
||||
clickDownloadLink(url, filename)
|
||||
}
|
||||
|
||||
function clickDownloadLink(url: string, filename: string) {
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = filename
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
setTimeout(() => URL.revokeObjectURL(url), 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user