diff --git a/picard/browser/browser.py b/picard/browser/browser.py index 0700be29e..84b3bf84b 100644 --- a/picard/browser/browser.py +++ b/picard/browser/browser.py @@ -65,11 +65,18 @@ class BrowserIntegration(QtNetwork.QTcpServer): def _process_request(self): conn = self.sender() - line = bytes(conn.readLine()).decode() conn.write(b"HTTP/1.1 200 OK\r\nCache-Control: max-age=0\r\n\r\nNothing to see here.") - conn.disconnectFromHost() + rawline = conn.readLine().data() + log.debug("Browser integration request: %r", rawline) + try: + line = rawline.decode() + except UnicodeDecodeError as e: + log.error(e) + return + finally: + conn.disconnectFromHost() + line = line.split() - log.debug("Browser integration request: %r", line) if line[0] == "GET" and "?" in line[1]: action, args = line[1].split("?") args = [a.split("=", 1) for a in args.split("&")]