New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow hyphens in usernames #39

Merged
merged 1 commit into from Jul 16, 2014

Conversation

Projects
None yet
2 participants
@nathantypanski
Contributor

nathantypanski commented Jul 16, 2014

Previously, GitHub usernames containing hyphens were broken: if a
hyphenated username were provided in a r=some-body request to bors,
bors would interpret that request as r=some.

The reason for this is the regex parsing the username in those comments
was only looking for a word (\w+, or equivalently [a-zA-Z0-9_]+),
and words end at hyphens.

This changes those regular expressions to look for any of the word
characters and additionally a hyphen character ([a-zA-Z0-9_-]+).

I am not able to test this in production (I don't have the configuration)
but my experiments at the interpreter suggest this regex is correct for
parsing usernames with hyphens.

>>> import re
>>> c = 'r=chris-morgan'
>>> [m.group(1)
     for m in [re.match(r"r=([a-zA-Z0-9_-]+)", c)]
     if m]
['chris-morgan']
>>> s = 'r=chris-morgan b2f6b40'
>>> [m.group(1)
     for m in [re.match(r"r=([a-zA-Z0-9_-]+) ([a-z0-9]+)", s)]
     if m]
['chris-morgan']

But if anyone has a good clue how to check if this works, let me know.

Closes #38.

allow hyphens in usernames
Previously, GitHub usernames containing hyphens were broken: if a
hyphenated username were provided in a `r=some-body` request to bors,
bors would interpret that request as `r=some`.

The reason for this is the regex parsing the username in those comments
was only looking for a word (`\w+`, or equivalently `[a-zA-Z0-9_]+`),
and words end at hyphens.

This changes those regular expressions to look for any of the word
characters and additionally a hyphen character (`[a-zA-Z0-9_-]+`).

brson added a commit that referenced this pull request Jul 16, 2014

@brson brson merged commit 82c8f35 into graydon:master Jul 16, 2014

@brson

This comment has been minimized.

Collaborator

brson commented Jul 16, 2014

Thanks! Note that Rust is using an out of date bors and will not get this change until some maintenance is done to bring our infrastructure up to date.

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