From 3fa35ef03ab3c2b91a2984cc848027e4e349fa96 Mon Sep 17 00:00:00 2001 From: andrew rumble Date: Wed, 12 Jun 2024 09:28:34 +0100 Subject: [PATCH] Share ignore logic between web and clsi GitOrigin-RevId: c4ae306413efb71989d2db410c3859cb69b3d5de --- services/clsi/app/js/OutputFileArchiveManager.js | 9 ++++++++- .../frontend/js/features/pdf-preview/util/file-list.js | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/services/clsi/app/js/OutputFileArchiveManager.js b/services/clsi/app/js/OutputFileArchiveManager.js index fb81ae6c35..51b4991838 100644 --- a/services/clsi/app/js/OutputFileArchiveManager.js +++ b/services/clsi/app/js/OutputFileArchiveManager.js @@ -6,6 +6,10 @@ const { open, realpath } = require('node:fs/promises') const path = require('path') 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) { let subDir if (userId != null) { @@ -74,7 +78,10 @@ module.exports = { ) 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( ({ path }) => `${contentDir}${OutputCacheManager.path(build, path)}` ) diff --git a/services/web/frontend/js/features/pdf-preview/util/file-list.js b/services/web/frontend/js/features/pdf-preview/util/file-list.js index b6c50e1798..73bcc4806e 100644 --- a/services/web/frontend/js/features/pdf-preview/util/file-list.js +++ b/services/web/frontend/js/features/pdf-preview/util/file-list.js @@ -1,4 +1,6 @@ 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'] export const buildFileList = (