url_validate() -> url_sanitise()

This commit is contained in:
jesopo 2019-07-02 14:15:49 +01:00
parent 534854127b
commit 637067c62c

View file

@ -7,7 +7,7 @@ from src import utils
REGEX_URL = re.compile("https?://[A-Z0-9{}]+".format(re.escape("-._~:/%?#[]@!$&'()*+,;=")), re.I) REGEX_URL = re.compile("https?://[A-Z0-9{}]+".format(re.escape("-._~:/%?#[]@!$&'()*+,;=")), re.I)
# best-effort tidying up of URLs # best-effort tidying up of URLs
def url_validate(url: str): def url_sanitise(url: str):
if url.endswith(")"): if url.endswith(")"):
# trim ")" from the end only if there's not a "(" to match it # trim ")" from the end only if there's not a "(" to match it
# google.com/) -> google.com/ # google.com/) -> google.com/