Skip to content

Commit

Permalink
Make extract_urls case insensitive
Browse files Browse the repository at this point in the history
We weren't matching URLs written like Www.example.com, so this fixes that.
  • Loading branch information
kitsuta committed Aug 24, 2023
1 parent cad5a6d commit dc4abad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion uber/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ def extract_urls(text):
attendees put whitespace after each URL so we can match complex
resources paths with a wide variety of characters.
"""
if not text:
return

regex=r"\b((?:https?:\/\/)?(?:(?:www\.)?(?:[\da-z\.-]+)\.(?:[a-z]{2,6}))(?::[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])?(?:\/\S*)*\/?)\b"
return re.findall(regex, text)
return re.findall(regex, text, re.IGNORECASE)


def create_valid_user_supplied_redirect_url(url, default_url):
Expand Down

0 comments on commit dc4abad

Please sign in to comment.