mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 03:19:59 +00:00
torrents: Clean up magnet URI quotation
A cosmetic change. Swapping quote_via to quote, we don't convert spaces to pluses, keeping the name intact (which only mattered until peers send the metadata).
This commit is contained in:
parent
bd419c5d39
commit
2bf96196cb
|
@ -1,6 +1,6 @@
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode, quote
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
from flask import current_app as app
|
from flask import current_app as app
|
||||||
|
@ -88,7 +88,7 @@ def create_magnet(torrent, max_trackers=5, trackers=None):
|
||||||
magnet_parts.append(('tr', tracker))
|
magnet_parts.append(('tr', tracker))
|
||||||
|
|
||||||
b32_info_hash = base64.b32encode(torrent.info_hash).decode('utf-8')
|
b32_info_hash = base64.b32encode(torrent.info_hash).decode('utf-8')
|
||||||
return 'magnet:?xt=urn:btih:' + b32_info_hash + '&' + urlencode(magnet_parts)
|
return 'magnet:?xt=urn:btih:' + b32_info_hash + '&' + urlencode(magnet_parts, quote_via=quote)
|
||||||
|
|
||||||
|
|
||||||
def create_default_metadata_base(torrent, trackers=None, webseeds=None):
|
def create_default_metadata_base(torrent, trackers=None, webseeds=None):
|
||||||
|
|
Loading…
Reference in a new issue