MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/238334

Change subject: Really recover from 'badtoken' error when uploading
......................................................................

Really recover from 'badtoken' error when uploading

Follow-up to 5df9b2d20beb2250f76bb6806f22118de7412e45. Back then I
didn't know this code well enough and only fixed this issue for the
final 'Details' step, and not for the initial 'Upload' step.

Bug: T71691
Bug: T112446
Change-Id: Ibe47a0bf2f8edeae75099afd51100662218d0de0
---
M resources/mw.UploadWizardUpload.js
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/34/238334/1

diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index 731cc07..a039609 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -202,6 +202,17 @@
                        if ( result.error.code ) {
                                code = result.error.code;
                        }
+                       if ( code === 'badtoken' ) {
+                               // mw.Api#badToken is new in MW 1.26, stay 
compatible with older versions
+                               if ( this.api.badToken ) {
+                                       this.api.badToken( 'edit' );
+                                       // Try again once
+                                       if ( !this.ignoreWarning[code] ) {
+                                               this.removeErrors( code );
+                                               return;
+                                       }
+                               }
+                       }
                        if ( code === 'filetype-banned' && 
result.error.blacklisted ) {
                                code = 'filetype-banned-type';
                                comma = mw.message( 'comma-separator' 
).escaped();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe47a0bf2f8edeae75099afd51100662218d0de0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: wmf/1.26wmf22
Gerrit-Owner: MarkTraceur <mtrac...@member.fsf.org>
Gerrit-Reviewer: Bartosz DziewoƄski <matma....@gmail.com>

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

Reply via email to