From 573efddf8b5bf438150e2a8a0bb885c40bbf2cd1 Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Fri, 22 Oct 2010 17:14:30 +0000 Subject: [PATCH] validation.py: strip leading and trailing whitespaces from hostname --- web/lib/validation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/lib/validation.py b/web/lib/validation.py index 9413634..3870272 100644 --- a/web/lib/validation.py +++ b/web/lib/validation.py @@ -11,8 +11,8 @@ def validate_hostname(data): Here we do additional hostname validation as described in http://www.i2p2.i2p/naming.html """ - # convert hostname to lowercase - data = data.lower() + # convert hostname to lowercase and strip leading and trailing whitespaces + data = data.lower().strip() # Must end with '.i2p'. if re.match(r'.*\.i2p$', data) == None: raise forms.ValidationError('Hostname doesn\'t ends with .i2p')