Skip to content

Commit a964f63

Browse files
authored
fix: improve regex for contains_url (#33886)
This regex is used for checking if a field contains a URL. We did this because we didn't want URLs in a user's "full name". The capturing groups on the current regex are not needed to capture a URL. This commit simplifies and makes the regex stricter by banning the character combination "://".
1 parent 97f39f6 commit a964f63

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

openedx/core/djangoapps/user_authn/views/registration_form.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def contains_url(value):
9393
"""
9494
Validator method to check whether full name contains url
9595
"""
96-
regex = re.findall(r'https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))*', value)
96+
regex = re.findall(r'://', value)
9797
return bool(regex)
9898

9999

0 commit comments

Comments
 (0)