Skip to content

Commit

Permalink
Fix mimetypes on attachments as some were incorrect. (#7671)
Browse files Browse the repository at this point in the history
Some file extension can produce invalid MIME types, for example text/txt, image/jpg, image/tif.
Also added htm to the list so that it would not produce application/htm.
  • Loading branch information
ianwallen authored Jan 30, 2024
1 parent f2f9b10 commit 9e4cb9d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,22 @@ public static String getFileContentType(Path file) throws IOException {
case "png":
case "gif":
case "bmp":
contentType = "image/" + ext;
break;
case "tif":
case "tiff":
contentType = "image/tiff";
break;
case "jpg":
case "jpeg":
contentType = "image/" + ext;
contentType = "image/jpeg";
break;
case "txt":
contentType = "text/plain";
break;
case "htm":
case "html":
contentType = "text/" + ext;
contentType = "text/html";
break;
default:
contentType = "application/" + ext;
Expand Down

0 comments on commit 9e4cb9d

Please sign in to comment.