public static MimeType mimeTypeOf(String mimeType) {
switch (mimeType) {
case "txt.html":
log.warn("Incorrect Mime-Type <{}> detected, fixing ...", mimeType);
mimeType = "text/html";
break;
case "file":
log.warn("Incorrect Mime-Type <{}> detected, fixing ...", mimeType);
mimeType = "application/octet-stream";
break;
}
if (mimeType.indexOf('\\') > 0) {
log.warn("Incorrect Mime-Type <{}> detected, fixing ...", mimeType);
mimeType = mimeType.replace("\\", "/");
}
return MimeType.fromMimeTypeString(mimeType);
}