Skip to content

fix: strip Windows-invalid characters in sanitizeIssueTitle (fixes #9229) - #9230

Open
Uong Dong Hung (hungud) wants to merge 1 commit into
microsoft:mainfrom
hungud:fix/9229-sanitize-windows-branch
Open

Uong Dong Hung (hungud) wants to merge 1 commit into
microsoft:mainfrom
hungud:fix/9229-sanitize-windows-branch

Conversation

@hungud

Copy link
Copy Markdown
Contributor

Fixes #9229

Problem

When using Start Working on an issue whose title contains <, >, or | (for example, when using ${sanitizedLowercaseIssueTitle} in githubIssues.issueBranchTitle), those characters were kept in the branch name. Pushing from Linux/macOS succeeds, but fetching the branch on Windows fails to create the remote-tracking ref with Invalid argument because <, >, and | are invalid path characters on Windows.

Changes

  • Added <, >, and | to the sanitization regex in sanitizeIssueTitle (src/github/utils.ts).
  • Added unit tests covering <, >, and | in src/test/github/utils.test.ts.

Verification & QA Proof

  1. TypeScript check (npx tsc -p tsconfig.json --noEmit and npx tsc -p tsconfig.test.json --noEmit) passed with 0 errors.
  2. Regression checks verified before and after the fix:

Before Fix (Red Test & Windows Git Fetch Failure)

Red Test Reproduced
VS Code UI Red

After Fix (Green Test & Windows Git Fetch Success)

Green Test Passed
VS Code UI Green

…crosoft#9229)

When creating an issue branch via Start Working on a non-Windows machine,
characters like <, >, and | were preserved in the generated branch name
because sanitizeIssueTitle did not strip them. Fetching that branch on
Windows fails with Invalid argument.

Add <, >, and | to the sanitization character class in sanitizeIssueTitle
and add regression unit tests in utils.test.ts.
Copilot AI balanced review requested due to automatic review settings November 26, 2026 10:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the change to strip Windows-invalid characters from sanitized issue titles.

No open issues 🎉

What changed in this PR

Fixes #9229 by removing <, >, and | from sanitized issue titles, preventing these Windows-invalid characters from entering branch names generated by Start Working.

Changes:

  • Extends sanitizeIssueTitle to strip the three characters.
  • Adds regression tests for each character individually and combined within a title.
File Description
src/​test/​github/​utils.test.ts Adds four sanitization regression cases.
src/​github/​utils.ts Extends the sanitization regex to remove <, >, and `

Review effort: Balanced

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.

Windows cannot fetch issue branches containing > from sanitizedLowercaseIssueTitle

2 participants