Skip to content

Update version slug to match single characters #1406

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readthedocs/builds/version_slug.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# +? -- allow multiple of those, but be not greedy about the matching
# (?: ... ) -- wrap everything so that the pattern cannot escape when used in
# regexes.
VERSION_SLUG_REGEX = '(?:[a-z0-9][-._a-z0-9]+?)'
VERSION_SLUG_REGEX = '(?:[a-z0-9][-._a-z0-9]*)'


class VersionSlugField(models.CharField):
Expand Down
6 changes: 6 additions & 0 deletions readthedocs/rtd_tests/tests/test_version_slug.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ def test_multiple_empty_names(self):
project=self.pip)
self.assertEqual(version.slug, 'unknown_a')

def test_single_letter(self):
version = Version.objects.create(
verbose_name='v',
project=self.pip)
self.assertEqual(version.slug, 'v')

def test_uniqueness(self):
version = Version.objects.create(
verbose_name='1!0',
Expand Down