LPS-45067 Avoid inputStream lost bytes when add file entry
LPS-45067 Abstract out mimetype logic into utility method