diff options
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r-- | server/controllers/client.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 352d45fbf..bbb518c1b 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -5,6 +5,7 @@ import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers' | |||
5 | import { asyncMiddleware } from '../middlewares' | 5 | import { asyncMiddleware } from '../middlewares' |
6 | import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' | 6 | import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' |
7 | import { ClientHtml } from '../lib/client-html' | 7 | import { ClientHtml } from '../lib/client-html' |
8 | import { logger } from '../helpers/logger' | ||
8 | 9 | ||
9 | const clientsRouter = express.Router() | 10 | const clientsRouter = express.Router() |
10 | 11 | ||
@@ -66,9 +67,14 @@ clientsRouter.use('/client/*', (req: express.Request, res: express.Response, nex | |||
66 | 67 | ||
67 | // Always serve index client page (the client is a single page application, let it handle routing) | 68 | // Always serve index client page (the client is a single page application, let it handle routing) |
68 | // Try to provide the right language index.html | 69 | // Try to provide the right language index.html |
69 | clientsRouter.use('/(:language)?', function (req, res) { | 70 | clientsRouter.use('/(:language)?', async function (req, res) { |
70 | if (req.accepts(ACCEPT_HEADERS) === 'html') { | 71 | if (req.accepts(ACCEPT_HEADERS) === 'html') { |
71 | return generateHTMLPage(req, res, req.params.language) | 72 | try { |
73 | await generateHTMLPage(req, res, req.params.language) | ||
74 | return | ||
75 | } catch (err) { | ||
76 | logger.error('Cannot generate HTML page.', err) | ||
77 | } | ||
72 | } | 78 | } |
73 | 79 | ||
74 | return res.status(404).end() | 80 | return res.status(404).end() |