Hello! I have a suggestion about the error messages of the /tools/create-dicom endpoint.
I am experimenting with a “dicomizer” feature in my application where I allow users to upload JPEG/PNG images. It works gracefully in the browser, but when we tried via mobile, we had a very weird error inside Orthanc:
I spent quite some time trying to understand what was going on, as a 404 made me think my application had some issue with requests from mobile devices. It turns out the issue was the fact that users were trying to upload .jpg files, where a lot of images are in this .jpg format instead of .jpeg, and I was wrongly setting image/jpg as the content type of the encoded files to send to Orthanc.
My suggestion is: since a 404 in this case is very misleading, can we improve the error message, e.g to say that the MIME type is wrong? I believe mobile image uploading is a very common case for dicomization
Indeed, it seems we can improve the error report here !
Could you provide us with a sample file and curl command to reproduce the issue ? That would help us prepare the work.
You receive a 404 because image/jpg is an invalid MIME type. I got this problem because images in phones have .jpg extension, and I was relying on this file extension to construct the MIME type.
A quarta-feira, 9 de novembro de 2022 à(s) 10:23:02 UTC, a…@orthanc.team escreveu:
Could you provide an exact and complete curl command that generates your error ?
I have attached the one I spent some time to recreate based on your message and the command is successful no matter if I use “image/jpeg” or “image/jpg”.
One of our customers had the same issue as you today and I could finally reproduce the problem. I was not able to reproduce it because I was using the old payload structure for this route.
Consequently, I have submitted the following change to avoid considering “image/jpg” as MIME-compliant in the source code of Orthanc, while preserving compatibility with Alain’s original modification: https://hg.orthanc-server.com/orthanc/rev/a3c3f13368ea