jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/323396 )

Change subject: Recover from an allowed warning in the first chunk of an upload
......................................................................


Recover from an allowed warning in the first chunk of an upload

Bug: T151562
Change-Id: If9e946138f50100dfb752f113b87344eea366116
---
M pywikibot/site.py
1 file changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Dalba: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/site.py b/pywikibot/site.py
index f4267ca..9084daa 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -6091,10 +6091,24 @@
                         _file_key = data['filekey']
                         if 'warnings' in data and not ignore_all_warnings:
                             if callable(ignore_warnings):
+                                restart = False
                                 if 'offset' not in data:
+                                    # This is a result of a warning in the
+                                    # first chunk. The chunk is not actually
+                                    # stashed so upload must be restarted if
+                                    # the warning is allowed.
+                                    # T112416 and T112405#1637544
+                                    restart = True
                                     data['offset'] = True
                                 if ignore_warnings(create_warnings_list(data)):
                                     # Future warnings of this run can be 
ignored
+                                    if restart:
+                                        return self.upload(
+                                            filepage, source_filename,
+                                            source_url, comment, text, watch,
+                                            True, chunk_size, None, 0,
+                                            report_success=False)
+
                                     ignore_warnings = True
                                     ignore_all_warnings = True
                                     offset = data['offset']

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If9e946138f50100dfb752f113b87344eea366116
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <lokal.pro...@gmail.com>
Gerrit-Reviewer: Dalba <dalba.w...@gmail.com>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Lokal Profil <lokal.pro...@gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.w...@gmail.com>
Gerrit-Reviewer: XZise <commodorefabia...@gmx.de>
Gerrit-Reviewer: Xqt <i...@gno.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to