[neon/neon/livecd-rootfs/Neon/release] /: magic-proxy: fix exception handling for URLError (LP: #1946520)

Brian Murray null at kde.org
Fri Jan 28 13:43:23 GMT 2022


Git commit fd6b62637b4a9d86d76800020cdda8e108a32378 by Brian Murray.
Committed on 18/11/2021 at 23:42.
Pushed by jriddell into branch 'Neon/release'.

magic-proxy: fix exception handling for URLError (LP: #1946520)

M  +7    -0    debian/changelog
M  +4    -2    magic-proxy

https://invent.kde.org/neon/neon/livecd-rootfs/commit/fd6b62637b4a9d86d76800020cdda8e108a32378

diff --git a/debian/changelog b/debian/changelog
index 779e89da..b79aea97 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+livecd-rootfs (2.664.35) UNRELEASED; urgency=medium
+
+  [ Thomas Bechtold ]
+  * magic-proxy: fix exception handling for URLError (LP: #1946520)
+
+ -- Brian Murray <brian at ubuntu.com>  Thu, 18 Nov 2021 15:41:40 -0800
+
 livecd-rootfs (2.664.34) focal; urgency=medium
 
   * Add the capability to build an ISO image for the Intel IoT project.
diff --git a/magic-proxy b/magic-proxy
index 10f19c47..af765c32 100755
--- a/magic-proxy
+++ b/magic-proxy
@@ -883,8 +883,10 @@ class ProxyingHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
             self.__send_response(e)
         except urllib.error.URLError as e:
             self.log_message(
-                "urlopen() failed for {} with {}".format(uri, e.reason))
-            self.send_error(501, e.reason)
+                "urlopen() failed for {} with {}".format(uri, str(e.reason)))
+            # URLError.reason can either be a string or another Exception
+            # So do convert it to a string before sending the error (LP: #1946520)
+            self.send_error(501, str(e.reason))
 
 
     def __get_host_path(self):



More information about the Neon-commits mailing list