Normally not reachable with "current", only with explicit version,
but as proven by some live crashes, there is some way to. So make
sure we look up the current version instead of crashing.
@login_required
def commentform(request, itemid, version, filename):
- v = get_object_or_404(Version, tree=version)
+ if version == 'current':
+ v = Version.objects.get(current=True)
+ else:
+ v = get_object_or_404(Version, tree=version)
if not v.supported:
# No docs comments on unsupported versions
return HttpResponseRedirect("/docs/{0}/{1}".format(version, filename))