Ref T12857. This is generally fairly fuzzy for now, but here's something concrete: when we build a large file with diffusion.filecontentquery, we compute the MIME type of all chunks, not just the initial chunk.
Instead, pass a dummy MIME type to non-initial chunks so we don't try to compute them. This mirrors logic elsewhere, in file.uploadchunk. This should perhaps be centralized at some point, but it's a bit tricky since the file doesn't know that it's a chunk until later.
Also, clean up the TempFile immediately -- this shouldn't actually affect anything, but we don't need it to live any longer than this.