Skip to content

Commit

Permalink
VExistingUname: strip surrounding spaces
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Deimos committed May 22, 2015
1 parent e772017 commit f4325ab
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions r2/r2/lib/validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,8 @@ def __init__(self, item, allow_deleted=False, *a, **kw):
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:])
Expand Down

0 comments on commit f4325ab

Please sign in to comment.