From f4325ab2e848be48bed40be5b68cc5d439d0df97 Mon Sep 17 00:00:00 2001 From: Chad Birch Date: Thu, 21 May 2015 19:10:03 -0600 Subject: [PATCH] VExistingUname: strip surrounding spaces This was causing all pages that use this validator to be unable to handle leading/trailing spaces around the username, since when chkuser() is called it will always return None due to their presence. Changing this will make a lot of pages more tolerant with usernames, like the message compose page, pages for banning users, adding them as approved submitters or moderators, etc. --- r2/r2/lib/validator/validator.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r2/r2/lib/validator/validator.py b/r2/r2/lib/validator/validator.py index 34684a55c..32d10ca9a 100644 --- a/r2/r2/lib/validator/validator.py +++ b/r2/r2/lib/validator/validator.py @@ -1596,6 +1596,8 @@ class VExistingUname(VRequired): VRequired.__init__(self, item, errors.NO_USER, *a, **kw) def run(self, name): + if name: + name = name.strip() if name and name.startswith('~') and c.user_is_admin: try: user_id = int(name[1:])