Skip to content

8397 mime type updates #7731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions Core/src/org/sleuthkit/autopsy/coreutils/FileTypeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@
*/
public final class FileTypeUtils {

// lists augmented with https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
private static final ImmutableSet<String> IMAGE_MIME_TYPES
= new ImmutableSet.Builder<String>()
.addAll(removeAll(
asList(
// remove any empty mime types provided by ImageIO.getReaderMIMETypes()
// This prevents mime types added by SPI implementations from causing errors
// (i.e. 'jai-imageio' utilized with IcePDF)
Arrays.stream(ImageIO.getReaderMIMETypes())
.filter((mimeType) -> StringUtils.isNotBlank(mimeType))
.toArray(String[]::new)),
// remove any empty mime types provided by ImageIO.getReaderMIMETypes()
// This prevents mime types added by SPI implementations from causing errors
// (i.e. 'jai-imageio' utilized with IcePDF)
Arrays.stream(ImageIO.getReaderMIMETypes())
.filter((mimeType) -> StringUtils.isNotBlank(mimeType))
.toArray(String[]::new)),
asList("application/octet-stream"))) //this claims to be supported, but is not really an image.
.add("image/bmp", //NON-NLS
"image/gif", //NON-NLS
Expand All @@ -59,7 +60,9 @@ public final class FileTypeUtils {
"image/x-ms-bmp", //NON-NLS
"image/x-xbitmap", //NON-NLS
"image/x-portable-graymap", //NON-NLS
"image/x-portable-bitmap" //NON-NLS
"image/x-portable-bitmap", //NON-NLS
"image/avif", //NON-NLS
"image/svg+xml" //NON-NLS
).build();
private static final ImmutableSet<String> AUDIO_MIME_TYPES
= new ImmutableSet.Builder<String>()
Expand All @@ -69,7 +72,13 @@ public final class FileTypeUtils {
"audio/ogg", //NON-NLS
"audio/wav", //NON-NLS
"audio/vnd.wave", //NON-NLS
"audio/x-ms-wma"//NON-NLS
"audio/x-ms-wma",//NON-NLS
"application/x-cdf",//NON-NLS
"audio/aac",//NON-NLS
"audio/x-midi",//NON-NLS
"audio/opus",//NON-NLS
"audio/3gpp", //NON-NLS
"audio/3gpp2" //NON-NLS
).build();
private static final ImmutableSet<String> VIDEO_MIME_TYPES
= new ImmutableSet.Builder<String>()
Expand All @@ -83,7 +92,9 @@ public final class FileTypeUtils {
"video/x-msvideo", //NON-NLS
"video/x-flv", //NON-NLS
"video/x-m4v", //NON-NLS
"video/x-ms-wmv"//NON-NLS
"video/x-ms-wmv",//NON-NLS
"video/mp2t", //NON-NLS
"video/webm" //NON-NLS
).build();
private static final ImmutableSet<String> DOCUMENT_MIME_TYPES
= new ImmutableSet.Builder<String>()
Expand Down Expand Up @@ -112,7 +123,21 @@ public final class FileTypeUtils {
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", //NON-NLS
"application/vnd.oasis.opendocument.presentation", //NON-NLS
"application/vnd.oasis.opendocument.spreadsheet", //NON-NLS
"application/vnd.oasis.opendocument.text" //NON-NLS
"application/vnd.oasis.opendocument.text", //NON-NLS
"application/epub+zip",//NON-NLS
"application/ld+json",//NON-NLS
"application/vnd.amazon.ebook",//NON-NLS
"application/vnd.visio",//NON-NLS
"application/x-abiword",//NON-NLS
"text/xml",//NON-NLS
"application/atom+xml",//NON-NLS
"text/calendar",//NON-NLS
"text/javascript",//NON-NLS
"application/vnd.mozilla.xul+xml",//NON-NLS
"application/x-csh",//NON-NLS
"application/x-httpd-php",//NON-NLS
"application/x-sh"//NON-NLS

).build();
private static final ImmutableSet<String> EXECUTABLE_MIME_TYPES
= new ImmutableSet.Builder<String>()
Expand All @@ -126,7 +151,8 @@ public final class FileTypeUtils {
"vms/exe",//NON-NLS
"application/x-winexe",//NON-NLS
"application/msdos-windows",//NON-NLS
"application/x-msdos-program"//NON-NLS
"application/x-msdos-program",//NON-NLS,
"application/java-archive" //NON-NLS
).build();
private static final ImmutableSet<String> MULTI_MEDIA_MIME_TYPES
= new ImmutableSet.Builder<String>()
Expand Down