Prechádzať zdrojové kódy

Share ignore logic between web and clsi

GitOrigin-RevId: c4ae306413efb71989d2db410c3859cb69b3d5de
andrew rumble 2 rokov pred
rodič
commit
3fa35ef03a

+ 8 - 1
services/clsi/app/js/OutputFileArchiveManager.js

@@ -6,6 +6,10 @@ const { open, realpath } = require('node:fs/promises')
 const path = require('path')
 const path = require('path')
 const { NotFoundError } = require('./Errors')
 const { NotFoundError } = require('./Errors')
 
 
+// NOTE: Updating this list requires a corresponding change in
+// * services/web/frontend/js/features/pdf-preview/util/file-list.js
+const ignoreFiles = ['output.fls', 'output.fdb_latexmk']
+
 function getContentDir(projectId, userId) {
 function getContentDir(projectId, userId) {
   let subDir
   let subDir
   if (userId != null) {
   if (userId != null) {
@@ -74,7 +78,10 @@ module.exports = {
       )
       )
 
 
       return outputFiles
       return outputFiles
-        .filter(({ path }) => path !== 'output.pdf')
+        .filter(
+          // Ignore the pdf and also ignore the files ignored by the frontend.
+          ({ path }) => path !== 'output.pdf' && !ignoreFiles.includes(path)
+        )
         .map(
         .map(
           ({ path }) => `${contentDir}${OutputCacheManager.path(build, path)}`
           ({ path }) => `${contentDir}${OutputCacheManager.path(build, path)}`
         )
         )

+ 2 - 0
services/web/frontend/js/features/pdf-preview/util/file-list.js

@@ -1,4 +1,6 @@
 const topFileTypes = ['bbl', 'gls', 'ind']
 const topFileTypes = ['bbl', 'gls', 'ind']
+// NOTE: Updating this list requires a corresponding change in
+// * services/clsi/app/js/OutputFileArchiveManager.js
 const ignoreFiles = ['output.fls', 'output.fdb_latexmk']
 const ignoreFiles = ['output.fls', 'output.fdb_latexmk']
 
 
 export const buildFileList = (
 export const buildFileList = (