From 7c27cac697d6c3d36cdc3650cfd52470f7318248 Mon Sep 17 00:00:00 2001 From: Deimos Date: Mon, 17 Jun 2019 15:32:12 -0600 Subject: [PATCH] Fix invalid links breaking url transformations Some links can get through to this point without a hostname, which will cause some of the transformers to crash. We'll just skip everything if there's no hostname, and it will end up getting rejected afterwards anyway. --- tildes/tildes/lib/url_transform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tildes/tildes/lib/url_transform.py b/tildes/tildes/lib/url_transform.py index 0df68b9..d1a6acd 100644 --- a/tildes/tildes/lib/url_transform.py +++ b/tildes/tildes/lib/url_transform.py @@ -44,6 +44,8 @@ def apply_url_transformations(url: str) -> str: def _is_exempt_from_transformations(parsed_url: ParseResult) -> bool: """Return whether this url should be exempt from the transformation process.""" + if not parsed_url.hostname: + return True # Paradox forums use an invalid url scheme that will break if processed if parsed_url.hostname == "forum.paradoxplaza.com":