Page MenuHomePhabricator

API cannot delete file when only the file is existent, but the associated discription page is deleted
Closed, ResolvedPublic

Description

Happens for example on https://commons.wikimedia.org/wiki/File:Zhuyifei1999-test.png.

Using ApiSandbox:
https://commons.wikimedia.org/wiki/Special:ApiSandbox#action=delete&format=json&title=File%3AZhuyifei1999-test.png&reason=test&token=REDACTED%2B%5C
creates:

{
    "error": {
        "code": "missingtitle",
        "info": "The page you specified doesn't exist.",
        "*": "See https://commons.wikimedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
    },
    "servedby": "mw1283"
}

Using action=delete via index.php (link is in "delete all" in the "File history" section) https://commons.wikimedia.org/w/index.php?title=File:Zhuyifei1999-test.png&action=delete works fine, but does not create a delete log entry (separate bug I guess)

Happens also to bots (because of all the race conditions happening in the Wikipedia Zero abuse fighting):

WARNING: API error missingtitle: The page you specified doesn't exist.
API Error: query=
u"{u'maxlag': ['5'], 'title': [FilePage(File:Kxv cv wxcv xcv wxc.xcf)], u'format': [u'json'], 'reason': [u'This file contains [[COM:CSD#F9', u'embedded data]]: After 452.6KiB (463489 bytes, via Ending,Magic): Identified type: application/x-rar (RAR archive data, v4, os: Win32)'], u'assert': [u'user'], 'token': [u'5077afe6a0dbe62233a9c036bb289639593c890e+\\\\'], 'action': [u'delete']}"
response=
{u'servedby': u'mw1276', u'error': {u'info': u"The page you specified doesn't exist.", u'code': u'missingtitle', u'help': u'See https://commons.wikimedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.'}}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 12 2017, 4:20 PM
Anomie claimed this task.Jun 12 2017, 5:09 PM

Change 358402 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] API: Allow deleting files without corresponding pages

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

Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.Jun 12 2017, 5:11 PM

Change 358402 merged by jenkins-bot:
[mediawiki/core@master] API: Allow deleting files without corresponding pages

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

Anomie closed this task as Resolved.Jun 26 2017, 2:10 PM