Fix mimetype detection

backport of https://github.com/owncloud/core/pull/5601 to stable5. fixes the issue on oracle at a customer

@karlitschek @DeepDiver1975 @VicDeo @bantu @kabum