Fix mimetype detection with the 'file' utility

Backport of https://github.com/owncloud/core/commit/d428d72dabf1d0f451f5dedc8e7e5cc654e04ffb to stable45

See comments to https://github.com/owncloud/core/commit/258782584e490b92ccfcf032921aa7062a28da9f
for details