FileGetMimeType() - throw an error on missing / empty files when strict=true

A proposed small Lucee 6.0 breaking change

Strict is by default true

  • when strict is false, this existing behaviour will be supported.
  • when strict is true, an empty or non existent file will now throw an error

https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-e-g/filegetmimetype.html

2 Likes

This also gets it in sync with ColdFusion yeah? (the ticket isn’t flagged as acf-compat, so not sure you’ve noticed).

FYI, test results on CF, with strict = true

valid.gif: image/gif
empty.gif: image/gif
actuallyJson.gif: text/plain
actuallyXml.gif: application/xml
nonExistent.gif: java.io.FileNotFoundException / /full/path/to/nonExistent.gif (No such file or directory)

That’s what you should be aiming for, yeah? Lucee is the same, except the last one.

Note that this conflicts with the proposal above when it comes to how “empty” is handled.