Skip to content

Commit f4325ab

Browse files
committed
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.
1 parent e772017 commit f4325ab

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

r2/r2/lib/validator/validator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,8 @@ def __init__(self, item, allow_deleted=False, *a, **kw):
15961596
VRequired.__init__(self, item, errors.NO_USER, *a, **kw)
15971597

15981598
def run(self, name):
1599+
if name:
1600+
name = name.strip()
15991601
if name and name.startswith('~') and c.user_is_admin:
16001602
try:
16011603
user_id = int(name[1:])

0 commit comments

Comments
 (0)