Explorar el Código

Merge pull request #17874 from overleaf/jpa-ol-project-id-in-env

[clsi] expose Overleaf project id to LaTeX compilation via env var

GitOrigin-RevId: cf8be6f8d83351a587d9ac7940f61a046a14035e
Jakob Ackermann hace 2 años
padre
commit
9351c03c3b

+ 3 - 1
services/clsi/app/js/CompileManager.js

@@ -107,7 +107,9 @@ async function doCompile(request) {
   timings.sync = writeToDiskTimer.done()
 
   // set up environment variables for chktex
-  const env = {}
+  const env = {
+    OVERLEAF_PROJECT_ID: request.project_id,
+  }
   if (Settings.texliveOpenoutAny && Settings.texliveOpenoutAny !== '') {
     // override default texlive openout_any environment variable
     env.openout_any = Settings.texliveOpenoutAny

+ 4 - 1
services/clsi/test/unit/js/CompileManagerTests.js

@@ -175,7 +175,9 @@ describe('CompileManager', function () {
         compileGroup: (this.compileGroup = 'compile-group'),
         stopOnFirstError: false,
       }
-      this.env = {}
+      this.env = {
+        OVERLEAF_PROJECT_ID: this.projectId,
+      }
     })
 
     describe('when the project is locked', function () {
@@ -285,6 +287,7 @@ describe('CompileManager', function () {
               CHKTEX_OPTIONS: '-nall -e9 -e10 -w15 -w16',
               CHKTEX_EXIT_ON_ERROR: 1,
               CHKTEX_ULIMIT_OPTIONS: '-t 5 -v 64000',
+              OVERLEAF_PROJECT_ID: this.projectId,
             },
             compileGroup: this.compileGroup,
             stopOnFirstError: this.request.stopOnFirstError,