From a301363ece230c4558fe71c7810e3dc27144cdd6 Mon Sep 17 00:00:00 2001 From: Domagoj Kriskovic Date: Thu, 20 Aug 2026 10:59:14 +0200 Subject: [PATCH] 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 --- services/web/frontend/js/utils/download-file.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/utils/download-file.ts b/services/web/frontend/js/utils/download-file.ts index 4b2fce760b..d424accbd1 100644 --- a/services/web/frontend/js/utils/download-file.ts +++ b/services/web/frontend/js/utils/download-file.ts @@ -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) }