From 747819fbd2c3c4293469d5e070eb5b29167d8097 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 26 Mar 2018 17:07:00 -0400 Subject: [PATCH] Fix error with unicode URLs in torrent creation Fixes https://jira.coreos.com/browse/QUAY-896 --- util/registry/test/test_torrent.py | 4 ++++ util/registry/torrent.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 util/registry/test/test_torrent.py diff --git a/util/registry/test/test_torrent.py b/util/registry/test/test_torrent.py new file mode 100644 index 000000000..4b909bd1e --- /dev/null +++ b/util/registry/test/test_torrent.py @@ -0,0 +1,4 @@ +from util.registry.torrent import make_torrent + +def test_make_torrent_unicode_url(): + make_torrent('foo', unicode('bar'), 10, 20, 'hello world') diff --git a/util/registry/torrent.py b/util/registry/torrent.py index 90f053d4c..3d3452dad 100644 --- a/util/registry/torrent.py +++ b/util/registry/torrent.py @@ -55,7 +55,7 @@ def make_torrent(name, webseed, length, piece_length, pieces): return bencode.bencode({ 'announce': ANNOUNCE_URL + "?jwt=" + jwt_from_infodict(info_dict), - 'url-list': webseed, + 'url-list': str(webseed), 'encoding': 'UTF-8', 'created by': REGISTRY_TITLE, 'creation date': int(time.time()),