Skip to content

Improve branch name sanitization - #526

Merged
joshaber merged 2 commits into
masterfrom
sanitize-branch-name
Oct 12, 2016
Merged

joshaber merged 2 commits into
masterfrom
sanitize-branch-name

Conversation

@haacked

@haacked haacked commented Oct 12, 2016 •

Copy link
Copy Markdown
Contributor

Also added some unit tests pulled from the GitHub Desktop for Windows code.

Fixes #291

@joshaber joshaber self-assigned this Oct 12, 2016
Also added some unit tests pulled from the GitHub Desktop for Windows
code.

Fixes #291
@haacked
haacked force-pushed the sanitize-branch-name branch from 7f5434f to 63d4d79 Compare October 12, 2016 20:56

@joshaber joshaber 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.

Seems legit 👍 Just one 📖

/** Sanitize a proposed branch name by replacing illegal characters. */
export function sanitizedBranchName(name: string): string {
return name.replace(/ /g, '-')
return name.replace(/[\x00-\x20\x7F~^:?*\[\\|""<>]|@{|\.\.+|^\.|\.$|\.lock$|\/$/g, '-')

This comment was marked as spam.

@joshaber

Copy link
Copy Markdown
Contributor

@joshaber
joshaber merged commit 2de7938 into master Oct 12, 2016
@joshaber
joshaber deleted the sanitize-branch-name branch October 12, 2016 21:19
mijiang168 pushed a commit to mijiang168/desktop that referenced this pull request Apr 22, 2022
mijiang168 pushed a commit to mijiang168/desktop that referenced this pull request Apr 22, 2022
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Jan 22, 2023
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Jan 22, 2023
yasuking0304 pushed a commit to yasuking0304/desktop that referenced this pull request Mar 9, 2023
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