-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix slug generation for uppercase branch names #1396
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
Conversation
…s unslugifiable chars.
…es with uppercase letters.
slug_length = len(slugified) | ||
|
||
if not slugified: | ||
return self.fallback_slug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also be +1 on replacing these blocks with regex comparisons/substitutions. These two blocks could be a single regex substitution, with a check against the final matches for empty/invalid slug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, that is addressed with the latest push. I've not used regex.sub before that's why I didn't think about it. It reduced the code quite a bit. Thanks for the suggestion!
Excellent, looks good |
Fix slug generation for uppercase branch names
There is another issue with slugs that was raised in #1176. The current implementation turns uppercase letters into dashes so that
SomeChar-charclass
as branch name results in-ome-har-charclass
as slug. However our regex in the URLs don't allow leading dashes.This PR changes the algorithm to strip punctuation from the generated slug. It includes a migration to fix the currently broken slugs. I tested locally that pypy's version page works after applying it.