diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/client-html.ts | 17 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { readFile } from 'fs-extra' | 2 | import { pathExists, readFile } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import validator from 'validator' | 4 | import validator from 'validator' |
5 | import { isTestOrDevInstance } from '@server/helpers/core-utils' | 5 | import { 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) |