allow hyphens in usernames #39

Merged
merged 1 commit into from Jul 16, 2014

Projects

None yet

2 participants

@nathantypanski
Contributor

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.

@nathantypanski nathantypanski 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_-]+`).
67c1d74
@brson brson merged commit 82c8f35 into graydon:master Jul 16, 2014
@brson
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