From 88db34b9064a49ce79b23f87cf451d2b050987af Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Wed, 23 Mar 2022 09:48:30 -0400 Subject: [PATCH] Merge pull request #7180 from overleaf/em-missing-pdf-download-domain Handle missing PDF_DOWNLOAD_DOMAIN setting GitOrigin-RevId: 3f022ec1637f7f38ca98503b1ab08748f6bbf87d --- .../js/features/pdf-preview/util/output-files.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/services/web/frontend/js/features/pdf-preview/util/output-files.js b/services/web/frontend/js/features/pdf-preview/util/output-files.js index 5b96f177c1..e4e99acdb0 100644 --- a/services/web/frontend/js/features/pdf-preview/util/output-files.js +++ b/services/web/frontend/js/features/pdf-preview/util/output-files.js @@ -10,6 +10,7 @@ export const handleOutputFiles = async (projectId, data) => { const result = {} const outputFiles = new Map() + const pdfDownloadDomain = data.pdfDownloadDomain ?? '' for (const outputFile of data.outputFiles) { outputFiles.set(outputFile.path, outputFile) @@ -37,7 +38,7 @@ export const handleOutputFiles = async (projectId, data) => { params.set('enable_pdf_caching', 'true') } - result.pdfUrl = `${data.pdfDownloadDomain}${outputFile.url}?${params}` + result.pdfUrl = `${pdfDownloadDomain}${outputFile.url}?${params}` // build the URL for downloading the PDF params.set('popupDownload', 'true') // save PDF download as file @@ -79,9 +80,7 @@ export const handleOutputFiles = async (projectId, data) => { const logFile = outputFiles.get('output.log') if (logFile) { - const response = await fetch( - `${data.pdfDownloadDomain}${logFile.url}?${params}` - ) + const response = await fetch(`${pdfDownloadDomain}${logFile.url}?${params}`) const log = await response.text() @@ -97,9 +96,7 @@ export const handleOutputFiles = async (projectId, data) => { const blgFile = outputFiles.get('output.blg') if (blgFile) { - const response = await fetch( - `${data.pdfDownloadDomain}${blgFile.url}?${params}` - ) + const response = await fetch(`${pdfDownloadDomain}${blgFile.url}?${params}`) const log = await response.text()