jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] APISite: Blocked IPv6 usernames in uppercase ......................................................................
[FIX] APISite: Blocked IPv6 usernames in uppercase
The usernames of anonymous users with an IPv6 address are saved with the letters uppercased. So when querying using such usernames (via bkusers) those need to be uppercased.
Unfortunately it's possible to fake IPv6 addresses using '::' and those might have not uppercase letters so it's not uppercasing them.
Change-Id: Iddfb2823cdfae16caa182ba7874beb5a08dd997b --- M pywikibot/site.py 1 file changed, 7 insertions(+), 0 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index 87cd7f1..9490b07 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -34,6 +34,7 @@ deprecated, deprecate_arg, deprecated_args, remove_last_args, redirect_func, manage_wrapping, MediaWikiVersion, normalize_username, ) +from pywikibot.tools.ip import is_IP from pywikibot.throttle import Throttle from pywikibot.data import api from pywikibot.exceptions import ( @@ -3577,6 +3578,12 @@ if blockids: bkgen.request["bkids"] = blockids if users: + if isinstance(users, basestring): + users = users.split('|') + # actual IPv6 addresses (anonymous users) are uppercase, but they + # have never a :: in the username (so those are registered users) + users = [user.upper() if is_IP(user) and '::' not in user else user + for user in users] bkgen.request["bkusers"] = users return bkgen
pywikibot-commits@lists.wikimedia.org