Page MenuHomePhabricator

delete.py undelete token no longer exists
Closed, ResolvedPublic

Description

pywikibot.exceptions.Error: Requested token 'undelete' is invalid on commons:commons wiki.
The undelete token no longer exists.

Event Timeline

Steinsplitter raised the priority of this task from to Needs Triage.
Steinsplitter updated the task description. (Show Details)
Steinsplitter subscribed.

Ugh bummer, technically it never existed so the code should never have worked. It is now CSRF and was previously depending on the deleted rev. The answer from an 1.19 wiki [[http://www.explainxkcd.com/wiki/api.php?action=paraminfo&modules=undelete&format=jsonfm|action=paraminfo&modules=undelete]] mentions:

{
	"name": "token",
	"description": "An undelete token previously retrieved through list=deletedrevs",
	"type": "string"
},

So it looks like we need to rewrite the undelete procedure. On newer wikis we can probably just use CSRF (when was that introduced) and for older wikis I need to look into the code to exactly determine what we need to do.

Also please post the complete traceback if possible (although in that case it's probably not helpful but it won't hurt).

XZise set Security to None.

On newer wikis we can probably just use CSRF (when was that introduced)

https://gerrit.wikimedia.org/r/#/c/153110/ ?

Change 224391 had a related patch set uploaded (by XZise):
[FIX] undelete: Get correct token

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

Okay the implementation in cdc2e9f4 did work originally as it assumed that the previous token was named undelete. But that is not the case and when d4e6e60c removed the static lists it can't find the token anymore because the API never supported that name.

Change 224391 merged by jenkins-bot:
[FIX] undelete: Get correct token

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

jayvdb subscribed.

Change 224431 had a related patch set uploaded (by XZise):
[FIX] undelete: Get correct token

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

Change 224431 merged by jenkins-bot:
[FIX] undelete: Get correct token

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