public class MimeManager extends Object
| Constructor and Description |
|---|
MimeManager(InputStream mimeTypesInputStream) |
| Modifier and Type | Method and Description |
|---|---|
String |
getSanitisedMimeType(String existingMimeType,
String fileName)
If the existing mime type is listed in
GENERIC_MIME_TYPES, then return a suggested
replacement by looking up the file registered under com.atlassian.jira.ContainerRegistrar#MIME_TYPES_INPUTSTREAM_KEY. |
String |
getSuggestedMimeType(String fileName)
Suggests a mime type for a file name by looking up the file registered under
com.atlassian.jira.ContainerRegistrar#MIME_TYPES_INPUTSTREAM_KEY. |
public MimeManager(InputStream mimeTypesInputStream)
public String getSanitisedMimeType(String existingMimeType, String fileName)
GENERIC_MIME_TYPES, then return a suggested
replacement by looking up the file registered under com.atlassian.jira.ContainerRegistrar#MIME_TYPES_INPUTSTREAM_KEY.
Else return the original mime type.
Useful when uploading files, and the browser is lazy / sets the wrong content type.
existingMimeType - The mime type that we currently know for this filefileName - The name of the fileGENERIC_MIME_TYPES;
otherwise, the existing mime type is returned.com.atlassian.jira.ContainerRegistrar#MIME_TYPES_INPUTSTREAM_KEYpublic String getSuggestedMimeType(String fileName)
com.atlassian.jira.ContainerRegistrar#MIME_TYPES_INPUTSTREAM_KEY.fileName - The name of the filecom.atlassian.jira.ContainerRegistrar#MIME_TYPES_INPUTSTREAM_KEYCopyright © 2002-2021 Atlassian. All Rights Reserved.