Browse Source

Add $ marker to validation regexes

..else they won't match the whole string.
Sebastian Lohff 1 year ago
parent
commit
8a162acee3
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      whoisdb/validators.py

+ 2
- 2
whoisdb/validators.py View File

@@ -14,7 +14,7 @@ import ipaddress
14 14
 
15 15
 @deconstructible
16 16
 class HandleValidator(validators.RegexValidator):
17
-	regex = r'^(?:[A-Z]+[0-9]*(-[A-Z]+)|AUTO)'
17
+	regex = r'^(?:[A-Z]+[0-9]*(-[A-Z]+)|AUTO)$'
18 18
 	message = _(
19 19
 		'Enter a valid handle (all uppercase)'
20 20
 	)
@@ -26,7 +26,7 @@ class HandleValidatorWithSuffix(validators.RegexValidator):
26 26
 	flags = re.ASCII if six.PY3 else 0
27 27
 
28 28
 	def __init__(self, suffix):
29
-		self.regex = r'^(?:[A-Z]+[0-9]*-%s|AUTO)' % re.escape(suffix)
29
+		self.regex = r'^(?:[A-Z]+[0-9]*-%s|AUTO)$' % re.escape(suffix)
30 30
 		self.message = _(
31 31
 			'Enter a valid handle with suffix %s (all uppercase), e.g. FOO3-%s' % (suffix, suffix)
32 32
 		)

Loading…
Cancel
Save