summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-11-21 06:54:20 +0100
committerDan McGee <dan@archlinux.org>2012-11-21 06:56:08 +0100
commita732d3cebcb8ff3170502b13d01ba90ac8efe26f (patch)
treecd91ce5bc57e1e5b42cffb041f426afb1523170a
parent94bb06971d115ea1b91e2461bc94fbd0fe948ff5 (diff)
downloadarchweb-a732d3cebcb8ff3170502b13d01ba90ac8efe26f.tar.gz
archweb-a732d3cebcb8ff3170502b13d01ba90ac8efe26f.tar.xz
Fix new magnet link generation
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.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/releng/models.py b/releng/models.py
index b3ab1a3..a22e01d 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(