From ed141d255ec129b9b4dc0a0a594e0312b84532d9 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 20 Jan 2021 14:07:40 +0000 Subject: [PATCH] Merge pull request #3583 from overleaf/bg-fix-view-cache-path cache precompiled views using the absolute path GitOrigin-RevId: 86666555860de03a96f48436e2101993caf58a5c --- services/web/app/src/infrastructure/Views.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/web/app/src/infrastructure/Views.js b/services/web/app/src/infrastructure/Views.js index b6f61b4cdb..5b7e431812 100644 --- a/services/web/app/src/infrastructure/Views.js +++ b/services/web/app/src/infrastructure/Views.js @@ -2,6 +2,7 @@ const logger = require('logger-sharelatex') const pug = require('pug') const globby = require('globby') const Settings = require('settings-sharelatex') +const path = require('path') // Generate list of view names from app/views @@ -31,16 +32,16 @@ module.exports = { let success = 0 let failures = 0 viewList.forEach(view => { + let filename = path.resolve(view + '.pug') // express views are cached using the absolute path try { - let filename = view + '.pug' pug.compileFile(filename, { cache: true, compileDebug: Settings.debugPugTemplates }) - logger.log({ view }, 'compiled') + logger.log({ filename }, 'compiled') success++ } catch (err) { - logger.error({ view, err: err.message }, 'error compiling') + logger.error({ filename, err: err.message }, 'error compiling') failures++ } })