Skip to content

Commit

Permalink
Regex support fix for IGNORE_URLS
Browse files Browse the repository at this point in the history
  • Loading branch information
Saurav Sharma authored and Saurav Sharma committed Feb 14, 2024
1 parent 1fbb4c6 commit d86431a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions django_guid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ def is_url_in_ignored_list(request: Union['HttpRequest', 'HttpResponse']) -> boo
"""
endpoint = request.path.strip('/')
for ignore_url in settings.ignore_urls:
pattern = ignore_url.replace("*", "[\s\S]+")
pattern = ignore_url.replace("*", r"[\s\S]+")
pattern = "^" + pattern + "$"
search = re.search(pattern, endpoint)
if search:
logger.info("URL Ignored")
# logger.info("URL Ignored")
return True
logger.info("URL not Ignored")
# logger.info("URL not Ignored")
return False

0 comments on commit d86431a

Please sign in to comment.