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
--
To view, visit
https://gerrit.wikimedia.org/r/195085
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iddfb2823cdfae16caa182ba7874beb5a08dd997b
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>