dear all,
i am trying to carry out some custom checks before uploading a file in mediawiki. i face the challenge that i cannot pass my own error messages to the visualeditor upload form. whatever error message i declare in the onVerifyFileUpload hook gets displayed in VE as This file did not pass file verification. my error message that i declare in the hook 'gets aggregated' in UploadFromChunks.php:201. ($this->getVerificationErrorCode())
i also tried other hooks to intercept/manipulate the error but to no avail (ApiMain::onException,APIGetAllowedParams, APIAfterExecute).
i use mediawiki 1.32.2.
is there a way i did not think of to display a custom error message in my case?
thank you and kind regards,
tom
Can you share your code (or a reduced test case), and a screenshot of the error you're getting? I just tried writing the following hook: https://phabricator.wikimedia.org/P10258
And defined the error test in MediaWiki:Custom-test-error on my test wiki.
And the VisualEditor uploader displayed the expected error message: https://phabricator.wikimedia.org/F31532153
I was testing on MediaWiki 1.35.0-alpha, so perhaps something changed since 1.32.2, but please check if that method works for you.
wikitech-l@lists.wikimedia.org