diff options
author | Alec Warner <antarus@gentoo.org> | 2012-10-02 19:28:25 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2012-10-02 19:28:25 +0000 |
commit | 03dd7f592879ead302d3b12ff91b4ea3ef95ce53 (patch) | |
tree | fe1fb516d78d255f5697a4954d9c50de889051e5 | |
parent | Do not render an HTML search box (google will render one for us.) (diff) | |
download | packages-3-03dd7f592879ead302d3b12ff91b4ea3ef95ce53.tar.gz packages-3-03dd7f592879ead302d3b12ff91b4ea3ef95ce53.tar.bz2 packages-3-03dd7f592879ead302d3b12ff91b4ea3ef95ce53.zip |
Don't prefix urls with a scheme if they already have a scheme.
-rw-r--r-- | web/lib/changelog_formatter.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/web/lib/changelog_formatter.py b/web/lib/changelog_formatter.py index 35dc5d7..536b0b0 100644 --- a/web/lib/changelog_formatter.py +++ b/web/lib/changelog_formatter.py @@ -1,4 +1,5 @@ import re +import urlparse from cherrypy.lib.tidy import html_break from web.lib.links import viewcvs_link, \ @@ -160,7 +161,12 @@ def _pretty_changelog_pass6(changelog): """Convert any URL markup to real links""" def markup(m): - url = 'http://'+m.group(1) + group = m.group(1) + url = urlparse.urlparse(group) + if not url.scheme: + url = 'http://' + m.group(1) + else: + url = group return '<a href="%s">%s</a>' % (url, url) changelog = _single_pass_re_loop(re_m_url, markup, changelog) return changelog |