jenkins-bot merged this change.
[IMPR] Simplify invalid title parsing
This is an alternate implementation of
https://gerrit.wikimedia.org/r/#/c/403957/
Change-Id: Ia2456e721472f9bb0386ab15ab1859aa54e63915
---
M pywikibot/page.py
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 12ccea5..6cff93b 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5569,13 +5569,11 @@
# * with 'relative' URLs. Forbid them explicitly.
if u'.' in t and (
- t == u'.' or t == u'..' or
- t.startswith(u'./') or
- t.startswith(u'../') or
+ t in ('.', '..') or
+ t.startswith(('./', '../')) or
u'/./' in t or
u'/../' in t or
- t.endswith(u'/.') or
- t.endswith(u'/..')
+ t.endswith(('/.', '/..'))
):
raise pywikibot.InvalidTitle(
u"(contains . / combinations): '%s'"
To view, visit change 405583. To unsubscribe, visit settings.