mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
128 stars 41 forks source link

Prevent add-on version number from ever being empty #6276

Closed willdurand closed 5 years ago

willdurand commented 5 years ago

xref: https://github.com/mozilla/addons/issues/861


https://sentry.prod.mozaws.net/operations/olympia-prod/issues/5075503/

NoReverseMatch: Reverse for 'addons.versions' with arguments '(u'solid-dark-pitch', u'')' not found. 2 pattern(s) tried: ['addon/(?P<addon_id>[^/<>"\']+)/versions/(?P<version_num>[^/]+)$', 'addon/(?P<addon_id>[^/<>"\']+)/versions/$']
(13 additional frame(s) were not displayed)
...
  File "rest_framework/serializers.py", line 527, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "rest_framework/fields.py", line 1893, in to_representation
    return method(value)
  File "olympia/addons/serializers.py", line 202, in get_url
    return absolutify(obj.get_url_path())
  File "olympia/versions/models.py", line 288, in get_url_path
    return reverse('addons.versions', args=[self.addon.slug, self.version])
  File "olympia/amo/urlresolvers.py", line 54, in reverse
    url = django_reverse(viewname, urlconf, args, kwargs, current_app)

NoReverseMatch: Reverse for 'addons.versions' with arguments '(u'solid-dark-pitch', u'')' not found. 2 pattern(s) tried: ['addon/(?P<addon_id>[^/<>"\']+)/versions/(?P<version_num>[^/]+)$', 'addon/(?P<addon_id>[^/<>"\']+)/versions/$']
diox commented 5 years ago

Yeah, this add-on is broken - it somehow has no version number, but the URL pattern wants one of at least one character. We can fix the reversing to make sure this doesn't fail there, but more importantly we should figure out why it has no version number attached and fix that, as its the root cause.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this bug should stay open, please comment on the issue with further details. Thank you for your contributions.