never serve torrents with https webseeds, some clients like uTorrent only support http, fixes #1272

This commit is contained in:
j 2013-02-19 20:19:30 +05:30
parent 4d4f391af0
commit f993650f81

View file

@ -997,6 +997,8 @@ class Item(models.Model):
self.torrent.seek(0)
data = ox.torrent.bdecode(self.torrent.read())
url = request.build_absolute_uri("%s/torrent/"%self.get_absolute_url())
if url.startswith('https://'):
url = 'http' + url[5:]
data['url-list'] = ['%s%s' % (url, u.split('torrent/')[1]) for u in data['url-list']]
return ox.torrent.bencode(data)