Optimise avatar requests
What does this MR do?
This re-applies the second commit from !19383 (merged), with extra handling around the case where we can't find a matching format based on file extension. See #36122 (comment 243387825) for more info.
I picked the manual-lookup case from that comment (Mime::Type.lookup_by_extension
) as the fallback case is confusing (we would set request.format
, but then check that it was set by using request.formats
). This is because the Rails API here is a bit weird.
Edited by Sean McGivern