commit f07be0844b2bed5213266bb6828a91582a0551da from: Aleksey Ryndin date: Mon Apr 22 11:40:03 2024 UTC Fix: On unsupported answer: 'latin-1' codec can't encode characters <...> commit - 8ad6b2ac5161889bd6d94a694a32eea11eaa9df6 commit + f07be0844b2bed5213266bb6828a91582a0551da blob - 59556928be2a11c98d3de2d177d9c8e5bb1c9a4f blob + 7ce955c4f825c324285edb92cab5b818cf89814b --- yah2g.py +++ yah2g.py @@ -139,7 +139,11 @@ class _RequestHandler(BaseHTTPRequestHandler): url = urljoin(url, splitted[1]) continue if not status.startswith("2"): - self.send_error(HTTPStatus.INTERNAL_SERVER_ERROR, "Unsupported answer: " + str(splitted)) + self.send_error( + HTTPStatus.INTERNAL_SERVER_ERROR, + f"Unsupported answer: {splitted[0]}", + splitted[1] if len(splitted) == 2 else None + ) return mime = splitted[1].lower() if len(splitted) == 2 else "text/gemini" if not mime.startswith("text/gemini"):