From 3ba4e8703ad18e6784166f5ed3a0457fb6a8ac97 Mon Sep 17 00:00:00 2001 From: SachaMPS Date: Thu, 13 Oct 2016 18:08:38 +0200 Subject: [PATCH] Allow UTF-8 strings to be passed to urlopen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following url extracted by a plugin is valid but urlopen would throw a unicode error without this change: http://www.netztransparenz.de/de/Systemstabilitätsverordnung_49-5.htm --- djangocms_link_manager/link_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangocms_link_manager/link_manager.py b/djangocms_link_manager/link_manager.py index 7fb0bb5..c5d3758 100644 --- a/djangocms_link_manager/link_manager.py +++ b/djangocms_link_manager/link_manager.py @@ -66,7 +66,7 @@ def validate_default(self, parts, verify_exists=False): else: if verify_exists: try: - response = urlopen(HeadRequest(url)) + response = urlopen(HeadRequest(url.encode("UTF-8"))) # NOTE: urllib should have already resolved any 301/302s return 200 <= response.code < 400 # pragma: no cover except (HTTPError, URLError):