Send mime-type for new files

Port of #4361 to master. Fixes #4355 on master.