From 1f71e339fbde08d2a81652fa99a4dca7a707b262 Mon Sep 17 00:00:00 2001 From: Jimmy Domagala-Tang Date: Thu, 15 Jun 2023 09:21:35 -0400 Subject: [PATCH] Merge pull request #12802 from overleaf/jdt-parse-all-blg fetch all blg files to report errors GitOrigin-RevId: eea9b0809e6b2efcf5df20961e94197c583463ef --- server-ce/nginx/clsi-nginx.conf | 8 ++++++++ services/clsi/nginx.conf | 18 ++++++++++++++++++ .../features/pdf-preview/util/output-files.js | 9 +++++++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/server-ce/nginx/clsi-nginx.conf b/server-ce/nginx/clsi-nginx.conf index fa546a16d8..b02edf01fe 100644 --- a/server-ce/nginx/clsi-nginx.conf +++ b/server-ce/nginx/clsi-nginx.conf @@ -33,10 +33,18 @@ server { location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/build/([0-9a-f-]+)/output/output\.([a-z]+)$ { alias /var/lib/sharelatex/data/output/$1-$2/generated-files/$3/output.$4; } + # handle .blg files for specific users + location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/build/([0-9a-f-]+)/output/(.+)\.blg$ { + alias /var/lib/sharelatex/data/output/$1-$2/generated-files/$3/$4.blg; + } # handle output files for anonymous users location ~ ^/project/([0-9a-f]+)/build/([0-9a-f-]+)/output/output\.([a-z]+)$ { alias /var/lib/sharelatex/data/output/$1/generated-files/$2/output.$3; } + # handle .blg files for anonymous users + location ~ ^/project/([0-9a-f]+)/build/([0-9a-f-]+)/output/(.+)\.blg$ { + alias /var/lib/sharelatex/data/output/$1/generated-files/$2/$3.blg; + } # PDF range for specific users location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/content/([0-9a-f-]+/[0-9a-f]+)$ { diff --git a/services/clsi/nginx.conf b/services/clsi/nginx.conf index 3db962bbff..ee59ef8467 100644 --- a/services/clsi/nginx.conf +++ b/services/clsi/nginx.conf @@ -56,6 +56,15 @@ server { } alias /output/$1-$2/generated-files/$3/output.$4; } + # handle .blg files for specific users + location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/build/([0-9a-f-]+)/output/(.+)\.blg$ { + if ($request_method = 'OPTIONS') { + # handle OPTIONS method for CORS requests + add_header 'Allow' 'GET,HEAD'; + return 204; + } + alias /output/$1-$2/generated-files/$3/$4.blg; + } # handle output files for anonymous users location ~ ^/project/([0-9a-f]+)/build/([0-9a-f-]+)/output/output\.([a-z]+)$ { if ($request_method = 'OPTIONS') { @@ -66,6 +75,15 @@ server { } alias /output/$1/generated-files/$2/output.$3; } + # handle .blg files for anonymous users + location ~ ^/project/([0-9a-f]+)/build/([0-9a-f-]+)/output/(.+)\.blg$ { + if ($request_method = 'OPTIONS') { + # handle OPTIONS method for CORS requests + add_header 'Allow' 'GET,HEAD'; + return 204; + } + alias /output/$1/generated-files/$2/$3.blg; + } # PDF range for specific users location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/content/([0-9a-f-]+/[0-9a-f]+)$ { 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 d01749eb5c..586356461a 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 @@ -99,9 +99,14 @@ export const handleLogFiles = async (outputFiles, data, signal) => { } } - const blgFile = outputFiles.get('output.blg') + const blgFiles = [] - if (blgFile) { + for (const [filename, file] of outputFiles) { + if (filename.endsWith('.blg')) { + blgFiles.push(file) + } + } + for (const blgFile of blgFiles) { try { const response = await fetchFromCompileDomain( buildURL(blgFile, data.pdfDownloadDomain, data.enableHybridPdfDownload),