public final class

AttachmentMimeTypeTranslator

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.util.AttachmentMimeTypeTranslator

Class Overview

Translates mime types for attachments.

Used to sanitize mime types for file uploads. CONF-18951

Summary

Public Constructors
AttachmentMimeTypeTranslator()
Public Methods
String resolveMimeType(String filename, String originalMimeType)
Resolve a mime type based on the filename.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AttachmentMimeTypeTranslator ()

Public Methods

public String resolveMimeType (String filename, String originalMimeType)

Resolve a mime type based on the filename. The originalMimeType might be used if there is no mime type registered for the given file type.

Parameters
filename The name of the file. The file extension will be used to determine the mime type.
originalMimeType The original mime type. This method might return the original mime type if it can not resolve a proper mime type for the given filename.
Returns
  • Mime type for the given file. Never returns null.