There are 3 comments.
 
 
XWiki Platform / cid:jira-generated-image-avatar-6bec8398-c0d7-4094-ae44-8e6d3f370393 XWIKI-23343 Open

Improve the error message displayed when attaching a file with an allowed Mimetype extension but its content doesn't match the allowed Mimetype

 
View issue   ยท   Add comment
 

3 comments

 
cid:jira-generated-image-avatar-4af2f78a-34fd-413f-850d-98be8108b3f1 Nikita Petrenko on 04/Aug/25 13:44
 

Note that you don't need step3, once you defined blocked mimetypes, the error can be reproduced as well. 

 

Since the causes of the error messages are different and the explanations in the messages should be different, I don't know for sure if this is a duplicate.

The reason why it's duplication from my point of view, because it's related to upload process, and the detailed error message can be found in Network request

messages:{UNKNOWN_ERROR:new Template(\"An error occurred while uploading #\\u007Bname}\"),\nINVALID_FILE_TYPE:new Template(\"The file #\\u007Bname} has an unsuported format\")

And for mentioned issue (XWIKI-22158) it will be different i.e

"{\"uploaded\":0,\"error\":{\"number\":400,\"message\":\"Error when uploading the file: it might exceed the configured maximum upload size.\"}}"
 
cid:jira-generated-image-avatar-4af2f78a-34fd-413f-850d-98be8108b3f1 Nikita Petrenko on 04/Aug/25 13:47
 
Note that you don't need step3, once you defined blocked mimetypes, the error can be reproduced as well. 

 
{quote}Since the causes of the error messages are different and the explanations in the messages should be different, I don't know for sure if this is a duplicate.
{quote}
The reason why it's duplication from my point of view, because it's related to upload process, and the detailed error message can be found in Network request
{code:none}
messages:{UNKNOWN_ERROR:new Template(\"An error occurred while uploading #\\u007Bname}\"),\nINVALID_FILE_TYPE:new Template(\"The file #\\u007Bname} has an unsuported format\"){code}

And for mentioned issue (XWIKI-22158) it will be different i.e


{code:none}
"{\"uploaded\":0,\"error\":{\"number\":400,\"message\":\"Error when uploading the file: it might exceed the configured maximum upload size.\"}}"
{code}

In [XWiki platform code|https://github.com/xwiki/xwiki-platform/blob/01179197fba891926291fe22b2e56f8d4479d55d/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/widgets/upload.js#L431-L439]
 
cid:jira-generated-image-avatar-4af2f78a-34fd-413f-850d-98be8108b3f1 Nikita Petrenko on 04/Aug/25 13:51
 

And in your case, XWiki returns wrong error message UNKNOWN_ERROR instead of INVALID_FILE_TYPE.