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:
TheAMM 2018-07-15 04:26:26 +03:00
parent bd419c5d39
commit 2bf96196cb
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import base64
import os
from urllib.parse import urlencode
from urllib.parse import urlencode, quote
import flask
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))
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):