From d9b8aa1322b64893ed4168d3f9f60403bb558794 Mon Sep 17 00:00:00 2001 From: Andrew Rumble Date: Mon, 17 Aug 2026 13:22:26 +0100 Subject: [PATCH] Merge pull request #36592 from overleaf/ar-remove-unused-output-zip-query-params [web] remove unused query params from download all link GitOrigin-RevId: e6c1ac8d8c7f369d7ea99c39ed0f0c3c596580b7 --- .../app/src/Features/Compile/CompileController.mjs | 14 -------------- .../js/features/pdf-preview/util/file-list.ts | 9 +++++++-- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/services/web/app/src/Features/Compile/CompileController.mjs b/services/web/app/src/Features/Compile/CompileController.mjs index b94f794ecc..f1f858f10a 100644 --- a/services/web/app/src/Features/Compile/CompileController.mjs +++ b/services/web/app/src/Features/Compile/CompileController.mjs @@ -356,20 +356,6 @@ const getOutputZipFromClsiSchema = z.object({ }), query: z.object({ clsiserverid: zz.clsiServerId().optional(), - // frontend's buildFileList always appends editorId/compileGroup, and - // (for the "Download all" archive link specifically) one `files` entry - // per output file, to the query string it builds - // (services/web/frontend/js/features/pdf-preview/util/file-list.ts). - // None of these three are read by the handler below -- the backend - // already knows the build's full file list -- they're carried along - // only because the archive URL is built from the same query-params - // object as the per-file download links. - editorId: z.uuid().optional(), - compileGroup: zz.compileGroup().optional(), - // a single file in the archive arrives as a bare string, not a - // one-element array -- Express's query parser only produces an array - // once a query key repeats - files: z.union([z.string(), z.array(z.string())]).optional(), // not consumed, traffic tag enable_pdf_caching: z.stringbool().optional(), }), diff --git a/services/web/frontend/js/features/pdf-preview/util/file-list.ts b/services/web/frontend/js/features/pdf-preview/util/file-list.ts index 205ba978aa..3e8f8e4ecc 100644 --- a/services/web/frontend/js/features/pdf-preview/util/file-list.ts +++ b/services/web/frontend/js/features/pdf-preview/util/file-list.ts @@ -82,12 +82,17 @@ export function buildFileList( const archivableFiles = [...files.top, ...files.other] if (outputFilesArchive && archivableFiles.length > 0) { - archivableFiles.forEach(file => params.append('files', file.path)) + const archiveParams = new URLSearchParams() + let archiveUrl = outputFilesArchive.url + if (params.has('clsiserverid')) { + archiveParams.set('clsiserverid', params.get('clsiserverid')!) + archiveUrl = `${outputFilesArchive.url}?${archiveParams.toString()}` + } files.archive = { ...outputFilesArchive, fileCount: archivableFiles.length, - url: `${outputFilesArchive.url}?${params.toString()}`, + url: archiveUrl, } } }