jenkins-bot merged this change.
[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(-)
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
To view, visit change 570867. To unsubscribe, or for help writing mail filters, visit settings.