Merge pull request #8567 from overleaf/jpa-missing-class

[web] fetch compileBackendClass for linked project output downloads

GitOrigin-RevId: fc29aa700df879402ba1734775160799ce8ce61d
This commit is contained in:
Jakob Ackermann 2022-06-23 16:05:45 +01:00 committed by Copybot
parent 69206eb363
commit 50dd7a37f7
3 changed files with 27 additions and 38 deletions

View file

@ -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 { compileBackendClass, compileGroup } = options
const readStream = request({
url,
method: 'GET',
timeout: 60 * 1000,
qs: { compileBackendClass, compileGroup, clsiserverid: clsiServerId },
})
)
}
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)
})
},
_buildRequestFromDocupdater(

View file

@ -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,17 +173,19 @@ 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
CompileManager.getProjectCompileLimits(sourceProjectId, (err, limits) => {
if (err) return callback(err)
ClsiManager.getOutputFileStream(
sourceProjectId,
userId,
compileGroup,
limits,
clsiServerId,
buildId,
sourceOutputFilePath,
@ -197,6 +198,7 @@ function _getFileStream(linkedFileData, userId, callback) {
}
)
})
})
}
function _compileAndGetFileStream(linkedFileData, userId, callback) {
@ -229,7 +231,7 @@ function _compileAndGetFileStream(linkedFileData, userId, callback) {
ClsiManager.getOutputFileStream(
sourceProjectId,
userId,
limits.compileGroup,
limits,
clsiServerId,
buildId,
sourceOutputFilePath,

View file

@ -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 {