Browse Source

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.
merge-requests/72/head
Deimos 5 years ago
parent
commit
7c27cac697
  1. 2
      tildes/tildes/lib/url_transform.py

2
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: def _is_exempt_from_transformations(parsed_url: ParseResult) -> bool:
"""Return whether this url should be exempt from the transformation process.""" """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 # Paradox forums use an invalid url scheme that will break if processed
if parsed_url.hostname == "forum.paradoxplaza.com": if parsed_url.hostname == "forum.paradoxplaza.com":

Loading…
Cancel
Save