MAX-Image-Caption-Generator icon indicating copy to clipboard operation
MAX-Image-Caption-Generator copied to clipboard

Add mime type inference when uploaded images are missing mime type

Open ajbozarth opened this issue 6 years ago • 3 comments

#9 added error checking for file type, but did so using mime type. This means that uploads with missing mime type (mime type = None) will fail even if the image is valid. This was discovered and addressed by the web app in https://github.com/IBM/MAX-Image-Caption-Generator-Web-App/pull/39

As per discussion in #9 we should look into adding the mime type fix in the model as well. This can either be done using the same method as the web app or by using the more robust python magic library.

ajbozarth avatar Aug 16 '18 18:08 ajbozarth

@ajbozarth should this be closed via #9?

gdequeiroz avatar Sep 10 '19 23:09 gdequeiroz

No this is a follow up to #9 but as referenced there we can close this as "will not fix" if we would rather not spend the dev time. This is a minor edge case that can be worked around client side when encountered (like we did in the web app).

ajbozarth avatar Sep 10 '19 23:09 ajbozarth

Yes, I agree. A properly written web application should send the correct mimetype instead of compromising the stability of this model.

xuhdev avatar Sep 10 '19 23:09 xuhdev