rietveld-codereview / rietveld

Code Review, hosted on Google App Engine
https://codereview.appspot.com
Apache License 2.0
557 stars 152 forks source link

"Invalid IPv6 URL [ValueError]" when publishing comments #541

Open palant opened 8 years ago

palant commented 8 years ago

Steps to reproduce:

  1. Upload a file for review containing the following line:
    `* [{{mercurial-book Mercurial: The definite guide (hgbook)}}](http://hgbook.red-bean.com)`
  2. Add a comment draft to this line.
  3. Press M to publish the comments.

Result:

The publish page errors out with "Invalid IPv6 URL [ValueError]".

Analysis:

This is a bug in Django's urlizetrunc template filter (or more precisely django.utils.html.urlize function) which is used in Rietveld's publish.html. It attempts to highlight hgbook)}}](http://hgbook.red-bean.com as a URL and calls urlparse.unsplit() on "http://hgbook)}}](http://hgbook.red-bean.com". This results in the exception above.

The issue was resolved in Django 1.6 by catching the error.