diff options
author | Dan McGee <dan@archlinux.org> | 2012-11-21 00:54:20 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-11-21 00:56:08 -0500 |
commit | a732d3cebcb8ff3170502b13d01ba90ac8efe26f (patch) | |
tree | cd91ce5bc57e1e5b42cffb041f426afb1523170a | |
parent | 94bb06971d115ea1b91e2461bc94fbd0fe948ff5 (diff) |
Fix new magnet link generationrelease_2012-11-20
Apparently clients don't like urlencoded values in the magnet link, so
%3A isn't treated the same as ':'.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | releng/models.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/releng/models.py b/releng/models.py index b3ab1a31..a22e01d6 100644 --- a/releng/models.py +++ b/releng/models.py @@ -1,5 +1,4 @@ import markdown -from urllib import urlencode from django.core.urlresolvers import reverse from django.db import models @@ -132,14 +131,14 @@ class Release(models.Model): return "iso/%s/archlinux-%s-dual.iso" % (self.version, self.version) def magnet_uri(self): - query = { - 'dn': "archlinux-%s-dual.iso" % self.version, - 'tr': ("udp://tracker.archlinux.org:6969", - "http://tracker.archlinux.org:6969/announce"), - } + query = [ + ('dn', "archlinux-%s-dual.iso" % self.version), + ('tr', "udp://tracker.archlinux.org:6969"), + ('tr', "http://tracker.archlinux.org:6969/announce"), + ] if self.torrent_infohash: - query['xt'] = "urn:btih:%s" % self.torrent_infohash - return "magnet:?%s" % urlencode(query, doseq=True) + query.insert(0, ('xt', "urn:btih:%s" % self.torrent_infohash)) + return "magnet:?%s" % '&'.join(['%s=%s' % (k, v) for k, v in query]) def info_html(self): return mark_safe(markdown.markdown( |