diff --git a/src/browser/pages/error.html b/src/browser/pages/error.html index b3ad56757ae2..f44df0539ccb 100644 --- a/src/browser/pages/error.html +++ b/src/browser/pages/error.html @@ -11,7 +11,7 @@ content="style-src 'self'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;" /> - {{ERROR_TITLE}} - code-server + {{ERROR_TITLE}} - {{APP_NAME}} diff --git a/src/node/routes/errors.ts b/src/node/routes/errors.ts index c1439d6adedc..5417dddfdce6 100644 --- a/src/node/routes/errors.ts +++ b/src/node/routes/errors.ts @@ -57,7 +57,8 @@ export const errorHandler: express.ErrorRequestHandler = async (err, req, res, n replaceTemplates(req, content) .replace(/{{ERROR_TITLE}}/g, statusCode.toString()) .replace(/{{ERROR_HEADER}}/g, statusCode.toString()) - .replace(/{{ERROR_BODY}}/g, escapeHtml(err.message)), + .replace(/{{ERROR_BODY}}/g, escapeHtml(err.message)) + .replace(/{{APP_NAME}}/g, (req.args && req.args["app-name"]) || "code-server"), ) } else { res.json({ diff --git a/test/unit/node/routes/errors.test.ts b/test/unit/node/routes/errors.test.ts index ffa8f479111c..d90b3b4c763f 100644 --- a/test/unit/node/routes/errors.test.ts +++ b/test/unit/node/routes/errors.test.ts @@ -20,9 +20,45 @@ describe("error page is rendered for text/html requests", () => { expect(res.status).toHaveBeenCalledWith(404) expect(res.send).toHaveBeenCalledWith(expect.not.stringContaining("