1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-09 14:28:03 +00:00

validation.py: check for http:/ in hostname

This is a common error.
This commit is contained in:
Hidden Z 2010-10-22 18:37:38 +00:00
parent 5da0cc4b59
commit b5c5a4051c

View File

@ -26,6 +26,8 @@ def validate_hostname(data):
# prevent common errors
if re.match(r'\.i2p$', data):
raise forms.ValidationError('Incomplete hostname')
if re.match(r'^http:/', data):
raise forms.ValidationError('Do not paste full URL, just domain')
# Must not contain '..'
if re.search(r'\.\.', data):
raise forms.ValidationError('".." in hostname')