jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/570867 )
Change subject: [bugfix] Fix as_filename for Windows ......................................................................
[bugfix] Fix as_filename for Windows
- MediaWiki: https://www.mediawiki.org/wiki/Manual:$wgIllegalFileChars - Windows: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Bug: T236614 Change-Id: Ia43e81b87ee0d088dfad5be4808086816425be78 --- M pywikibot/page.py 1 file changed, 5 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index aea88fa..b730794 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -373,9 +373,12 @@ title = quote_from_bytes(encoded_title, safe='') if as_filename: # Replace characters that are not possible in file names on some - # systems. + # systems, but still are valid in MediaWiki titles: + # Unix: / + # MediaWiki: /:\ + # Windows: /:"?* # Spaces are possible on most systems, but are bad for URLs. - for forbidden in ':*?/\ ': + for forbidden in ':*?/\" ': title = title.replace(forbidden, '_') return title
pywikibot-commits@lists.wikimedia.org