$kirby->visitor()->acceptsMimeType('image/foo') returns true

I don’t know why, that mime type doesn’t even exist. Also if I check for blabla/asdf it returns true. But why? I don’t understand, might someone tell me or is this a bug I’ve just encountered?

I want to check if the browser of the visitor supports avif image format, I thought it would be best to use above method for.

Hm, yes, getting the same. It happens because in $this->acceptedMimeType() returns

"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"

Because of */*, anything foo/bar will match. The method just checks a matching pattern.

Probably makes more sense to check if $_SERVER['HTTP_ACCEPT'] explicitly contains the string image/avif, at least that’s what I did in a plugin.

I have no idea if that is intended behavior of the method.

On a side note, If you use a picture tag, you can provide multiple image sources (avif, webp, jpg) without having to check if the browser supports it.