Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403957 )

Change subject: [IMPR] use regex to parse invalid title
......................................................................

[IMPR] use regex to parse invalid title

Change-Id: Ibfd5a548a7c2a9be67d0f60c55fed9054af27971
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/57/403957/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 67ff263..ec6e457 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5547,16 +5547,7 @@
         # Pages with "/./" or "/../" appearing in the URLs will
         # often be unreachable due to the way web browsers deal
         # * 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
-                u'/./' in t or
-                u'/../' in t or
-                t.endswith(u'/.') or
-                t.endswith(u'/..')
-        ):
+        if re.search(r'(?:^(?:\.{1,2}(?:$|/))|/\.{1,2}/|/\.{1,2}$)', t):
             raise pywikibot.InvalidTitle(
                 u"(contains . / combinations): '%s'"
                 % self._text)

-- 
To view, visit https://gerrit.wikimedia.org/r/403957
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfd5a548a7c2a9be67d0f60c55fed9054af27971
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to