Repository navigation
fix: strip Windows-invalid characters in sanitizeIssueTitle (fixes #9229) - #9230
Open
Uong Dong Hung (hungud) wants to merge 1 commit into
Open
Uong Dong Hung (hungud) wants to merge 1 commit into
Uong Dong Hung (hungud) wants to merge 1 commit into
Conversation
…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.
Contributor
There was a problem hiding this comment.
🟢 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
sanitizeIssueTitleto 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9229
Problem
When using Start Working on an issue whose title contains
<,>, or|(for example, when using${sanitizedLowercaseIssueTitle}ingithubIssues.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 withInvalid argumentbecause<,>, and|are invalid path characters on Windows.Changes
<,>, and|to the sanitization regex insanitizeIssueTitle(src/github/utils.ts).<,>, and|insrc/test/github/utils.test.ts.Verification & QA Proof
npx tsc -p tsconfig.json --noEmitandnpx tsc -p tsconfig.test.json --noEmit) passed with 0 errors.Before Fix (Red Test & Windows Git Fetch Failure)
After Fix (Green Test & Windows Git Fetch Success)