You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Publish file uploads via the MediaWiki upload stash #155
WikiFileController.put uploads before storing the entity (#153). Since a file and its description page share one title, action=upload creates the page as a side effect, with empty wikitext and no jsondata slot.
Consequences:
an extra empty revision at the bottom of every new file's history
put has to force overwrite="replace remote" so the metadata lands on a page that exists but holds nothing
Use MediaWiki's upload stash, which separates accepting the bytes from publishing them to a title:
action=upload&stash=1 returns a filekey and creates no page
store_entity creates the page normally, with page.exists false and no policy override
action=upload&filekey=...&filename=... publishes onto the page that now exists, so text is ignored and nothing is rewritten
One content revision, the caller's overwrite untouched, no validator noise. Failure behaviour improves in both directions: a file the wiki refuses never reaches step 2, and if step 2 fails nothing is published and the stash expires on its own, needing no delete rights.
Effort
mwclient exposes no stash parameter. Site.post forwards to api(), which takes no files, so step 1 needs raw_call('api', data, files={'file': ...}) with manual result handling, roughly 15 lines mirroring Site.upload. Step 3 can use Site.upload(filekey=...) as is.
Activity