Page MenuHomePhabricator

Specific SVG file shows "File extension .svg does not match the detected MIME type of the file (image/png)." error
Closed, InvalidPublic

Description

Hello! In arwiki we import files from enwiki but when I try to upload "SVG" by API I get this error:

File extension \".svg\" does not match the detected MIME type of the file (image/png).

Is there any solution?
Thank you.

Event Timeline

Kizule subscribed.

Hi,
I've never seen a request like this. I don't think it's a problem with MediaWiki. Can you give us steps to reproduce?

Hi @Zoranzoki21 I wanted to upload this file: [[en:File:Kuwait Petroleum Corporation Logo.svg]] by API but I get this error:

{"error":{"code":"verification-error","info":"File extension \".svg\" does not match the detected MIME type of the file (image/png).","details":["filetype-mime-mismatch","svg","image/png"],"*":"See https://ar.wikipedia.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":"mw1222"}

How you wanted to uploaded file? How by API? Via browser or?

Closing as invalid because there is no bug.
Please read the error message: File extension \".svg\" does not match the detected MIME type of the file (image/png).

Sorry for my previous comment, not sure what I did wrong. Full link: https://en.wikipedia.org/wiki/File:Kuwait_Petroleum_Corporation_Logo.svg

$:acko\> file -i Kuwait_Petroleum_Corporation_Logo.svg 
Kuwait_Petroleum_Corporation_Logo.svg: image/svg+xml; charset=us-ascii
Aklapper renamed this task from Support upload "SVG" files by API on arwiki to Specific SVG file shows "File extension .svg does not match the detected MIME type of the file (image/png)." error.Nov 23 2019, 11:38 PM

What is possible (steps):

  1. Go on https://en.wikipedia.org/wiki/File:Kuwait_Petroleum_Corporation_Logo.svg
  2. Right click and click on Open image in new tab (Chrome)
  3. Copy URL https://upload.wikimedia.org/wikipedia/en/thumb/8/8d/Kuwait_Petroleum_Corporation_Logo.svg/418px-Kuwait_Petroleum_Corporation_Logo.svg.png
  4. Try to upload via API

Looks like this is reason for error. And it is expected, because URL is to png file.

Given that the file could be uploaded to Commons, which sends it through the exact same checks, this is probably user error. (Although I guess the mimetype testing code could have changed since it has been uploaded, but it seems very unlikely.)

@Jar: Unfortunately closing this Phabricator task as no further information has been provided. In the future, please follow https://www.mediawiki.org/wiki/How_to_report_a_bug and provide a list of clear steps to reproduce, expected outcome, and actual outcome. Thanks.