jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/636164 )
Change subject: [bugfix] upload a file that ends with the '\r' byte
......................................................................
[bugfix] upload a file that ends with the '\r' byte
Workaround (hack) for T132676.
Append another '\r' so that one is the payload and the second is used
for newline when mangled by email package.
Bug: T132676
Change-Id: I06d4c512a9cc1c29c5aa242f098ac2f533f6a59f
---
M pywikibot/site/__init__.py
1 file changed, 8 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index f4408a1..9356600 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -5700,6 +5700,14 @@
while True:
f.seek(offset)
chunk = f.read(chunk_size)
+ # workaround (hack) for T132676
+ # append another '\r' so that one is the payload and
+ # the second is used for newline when mangled by email
+ # package.
+ if (len(chunk) < chunk_size
+ or (offset + len(chunk)) == filesize
+ and chunk[-1] == b'\r'[0]):
+ chunk += b'\r'
req = self._request(
throttle=throttle, mime=True,
parameters={
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/636164
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I06d4c512a9cc1c29c5aa242f098ac2f533f6a59f
Gerrit-Change-Number: 636164
Gerrit-PatchSet: 2
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged