8000 gh-543 Update regex to include hyphens in username by jmathai · Pull Request #544 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content

gh-543 Update regex to include hyphens in username #544

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

Merged
merged 1 commit into from
Apr 15, 2016

Conversation

jmathai
Copy link
Contributor
@jmathai jmathai commented Jan 17, 2016

Fix bug where a username which contains a hyphen cannot be used in the GitHub.pubsubhubbub method.

@jmathai
Copy link
Contributor Author
jmathai commented Jan 17, 2016

Haven't done much python so I'm not sure I understand the build failures. Let me know if I can do anything else to help get this merged.

@@ -996,7 +996,8 @@ def pubsubhubbub(self, mode, topic, callback, secret=''):
:returns: bool
"""
from re import match
m = match('https?://[\w\d\-\.\:]+/\w+/[\w\._-]+/events/\w+', topic)
m = match('https?://[\w\d\-\.\:]+/\w+[\w-]+\w/[\w\._-]+/events/\w+',
Copy link
Owner

Choose a reason for hiding this comment

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

Based on what you said GitHub's sign-up allows, shouldn't the username regexp be \w[\w-]+\w because then you'd be able to have a-b or a-bcdefg-h etc.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Upon further reflection I don't think we should validate too strictly what GitHub says a valid username is today. They might change it, right?

How about [\w-]+?

Copy link
Owner

Choose a reason for hiding this comment

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

It's unlikely that they'll change this. Fixing it later is also always easy and I'd like to not be too relaxed in the data we accept.

@sigmavirus24
Copy link
Owner

The test failures aren't your fault. We'll fix those separately once you've updated the PR with my comments. Thanks!

@sigmavirus24
Copy link
Owner

Closing & re-opening should trigger a new merged build from Travis which should pass for you @jmathai

@jmathai jmathai force-pushed the develop branch 2 times, most recently from 7e3f9ea to 1b70765 Compare April 5, 2016 23:07
@jmathai
Copy link
Contributor Author
jmathai commented Apr 5, 2016

@sigmavirus24 updated the regex per your comments, reverted the test I changed and added a few new ones.

Fix bug where a username which contains a hyphen cannot be used in the `GitHub.pubsubhubbub` method.
@jmathai
Copy link
Contributor Author
jmathai commented Apr 7, 2016

Rebased. Should be ready for review/merge.

@sigmavirus24
Copy link
Owner

Thanks @jmathai! 🍰

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
0