Просмотр исходного кода

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

[web] fetch compileBackendClass for linked project output downloads

GitOrigin-RevId: fc29aa700df879402ba1734775160799ce8ce61d
Jakob Ackermann 4 лет назад
Родитель
Сommit
50dd7a37f7

+ 8 - 20
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(

+ 19 - 17
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,

+ 0 - 1
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 {