Skip to content

feat: use --app-name in error page title#7693

Open
lustsazeus-lab wants to merge 1 commit intocoder:mainfrom
lustsazeus-lab:main
Open

feat: use --app-name in error page title#7693
lustsazeus-lab wants to merge 1 commit intocoder:mainfrom
lustsazeus-lab:main

Conversation

@lustsazeus-lab
Copy link

@lustsazeus-lab lustsazeus-lab commented Mar 4, 2026

This PR fixes partially addresses #7688 - when using --app-name flag, the error pages should display the custom app name instead of hardcoded "code-server".

Changes

  • Updated error.html to use {{APP_NAME}} template variable instead of hardcoded "code-server"
  • Updated errors.ts to replace {{APP_NAME}} with the value from --app-name flag (defaults to "code-server")
  • Added unit tests for the app-name feature

Testing

  • TypeScript compiles without errors
  • Unit tests added for custom app-name and default value

Partially addresses #7688

- Replace hardcoded 'code-server' with {{APP_NAME}} template in error.html
- Add APP_NAME replacement in errors.ts using req.args['app-name']
- Add tests for custom app-name and default value
@lustsazeus-lab lustsazeus-lab requested a review from a team as a code owner March 4, 2026 19:11
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for tackling this! We might want to use the i18n strings for this eventually (like the login title), but this is definitely a step in the right direction.

FYI I modified your PR description from "fixes" and "closes" to "partially addresses" because to fully fix that issue we also need to set the VS Code titles (I think? I need to test actually. Edit yeah app name does not currently affect VS Code titles.)

.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"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor note, but I believe req.args is always set so there is no need to check for it. Could just be req.args["app-name"] || "code-server".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants