aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/lib/client-html.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index 8530cbcc2..058f29f03 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -1,5 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { readFile } from 'fs-extra' 2import { pathExists, readFile } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import validator from 'validator' 4import validator from 'validator'
5import { isTestOrDevInstance } from '@server/helpers/core-utils' 5import { isTestOrDevInstance } from '@server/helpers/core-utils'
@@ -408,7 +408,20 @@ class ClientHtml {
408 } 408 }
409 409
410 private static async addAsyncPluginCSS (htmlStringPage: string) { 410 private static async addAsyncPluginCSS (htmlStringPage: string) {
411 const globalCSSContent = await readFile(PLUGIN_GLOBAL_CSS_PATH) 411 if (!pathExists(PLUGIN_GLOBAL_CSS_PATH)) {
412 logger.info('Plugin Global CSS file is not available (generation may still be in progress), ignoring it.')
413 return htmlStringPage
414 }
415
416 let globalCSSContent: Buffer
417
418 try {
419 globalCSSContent = await readFile(PLUGIN_GLOBAL_CSS_PATH)
420 } catch (err) {
421 logger.error('Error retrieving the Plugin Global CSS file, ignoring it.', { err })
422 return htmlStringPage
423 }
424
412 if (globalCSSContent.byteLength === 0) return htmlStringPage 425 if (globalCSSContent.byteLength === 0) return htmlStringPage
413 426
414 const fileHash = sha256(globalCSSContent) 427 const fileHash = sha256(globalCSSContent)