From 50dd7a37f72039c097c719aeb9074cdc5ee36690 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 23 Jun 2022 16:05:45 +0100 Subject: [PATCH] Merge pull request #8567 from overleaf/jpa-missing-class [web] fetch compileBackendClass for linked project output downloads GitOrigin-RevId: fc29aa700df879402ba1734775160799ce8ce61d --- .../app/src/Features/Compile/ClsiManager.js | 28 +++++---------- .../LinkedFiles/ProjectOutputFileAgent.js | 36 ++++++++++--------- .../modes/file-tree-import-from-project.js | 1 - 3 files changed, 27 insertions(+), 38 deletions(-) diff --git a/services/web/app/src/Features/Compile/ClsiManager.js b/services/web/app/src/Features/Compile/ClsiManager.js index 1c67c95b02..a8bf1c70e0 100644 --- a/services/web/app/src/Features/Compile/ClsiManager.js +++ b/services/web/app/src/Features/Compile/ClsiManager.js @@ -694,33 +694,21 @@ const ClsiManager = { getOutputFileStream( projectId, userId, - compileGroup, + options, clsiServerId, buildId, outputFilePath, callback ) { const url = `${Settings.apis.clsi.url}/project/${projectId}/user/${userId}/build/${buildId}/output/${outputFilePath}` - // TODO(das7pad): remove one week after landing frontend changes. - ClsiCookieManager.getCookieJar(projectId, userId, '', (err, jar) => { - if (err != null) { - return callback( - OError.tag(err, 'Failed to get cookie jar', { - projectId, - userId, - buildId, - outputFilePath, - }) - ) - } - const options = { url, method: 'GET', timeout: 60 * 1000, jar } - if (clsiServerId) { - options.qs = { compileGroup, clsiserverid: clsiServerId } - delete options.jar - } - const readStream = request(options) - callback(null, readStream) + const { compileBackendClass, compileGroup } = options + const readStream = request({ + url, + method: 'GET', + timeout: 60 * 1000, + qs: { compileBackendClass, compileGroup, clsiserverid: clsiServerId }, }) + callback(null, readStream) }, _buildRequestFromDocupdater( diff --git a/services/web/app/src/Features/LinkedFiles/ProjectOutputFileAgent.js b/services/web/app/src/Features/LinkedFiles/ProjectOutputFileAgent.js index 9b3678f3b2..cc24a1133e 100644 --- a/services/web/app/src/Features/LinkedFiles/ProjectOutputFileAgent.js +++ b/services/web/app/src/Features/LinkedFiles/ProjectOutputFileAgent.js @@ -132,7 +132,6 @@ function _sanitizeData(data) { source_output_file_path: data.source_output_file_path, build_id: data.build_id, clsiServerId: data.clsiServerId, - compileGroup: data.compileGroup, } } @@ -174,28 +173,31 @@ function _getFileStream(linkedFileData, userId, callback) { source_output_file_path: sourceOutputFilePath, build_id: buildId, clsiServerId, - compileGroup, } = linkedFileData LinkedFilesHandler.getSourceProject(linkedFileData, (err, project) => { if (err) { return callback(err) } const sourceProjectId = project._id - ClsiManager.getOutputFileStream( - sourceProjectId, - userId, - compileGroup, - clsiServerId, - buildId, - sourceOutputFilePath, - (err, readStream) => { - if (err) { - return callback(err) + CompileManager.getProjectCompileLimits(sourceProjectId, (err, limits) => { + if (err) return callback(err) + + ClsiManager.getOutputFileStream( + sourceProjectId, + userId, + limits, + clsiServerId, + buildId, + sourceOutputFilePath, + (err, readStream) => { + if (err) { + return callback(err) + } + readStream.pause() + callback(null, readStream) } - readStream.pause() - callback(null, readStream) - } - ) + ) + }) }) } @@ -229,7 +231,7 @@ function _compileAndGetFileStream(linkedFileData, userId, callback) { ClsiManager.getOutputFileStream( sourceProjectId, userId, - limits.compileGroup, + limits, clsiServerId, buildId, sourceOutputFilePath, diff --git a/services/web/frontend/js/features/file-tree/components/file-tree-create/modes/file-tree-import-from-project.js b/services/web/frontend/js/features/file-tree/components/file-tree-create/modes/file-tree-import-from-project.js index 9d5f50eaba..396f256142 100644 --- a/services/web/frontend/js/features/file-tree/components/file-tree-create/modes/file-tree-import-from-project.js +++ b/services/web/frontend/js/features/file-tree/components/file-tree-create/modes/file-tree-import-from-project.js @@ -95,7 +95,6 @@ export default function FileTreeImportFromProject() { source_output_file_path: selectedProjectOutputFile.path, build_id: selectedProjectOutputFile.build, clsiServerId: selectedProjectOutputFile.clsiServerId, - compileGroup: selectedProjectOutputFile.compileGroup, }, }) } else {