MIME Type Resolution Configuration
Introduction
The CMS uses a configurable MIME type resolution service to map file extensions to their known MIME type variants. This is primarily used by the file upload components to determine which files to accept.
Different browsers may report different MIME types for the same file type. For example, a .csv file may be reported as text/csv, application/csv, or text/x-csv depending on the browser and operating system. The MIME type resolution service returns all known variants for a given extension so that file uploads work consistently across browsers.
Configuration
The extension-to-MIME-type mappings are stored in the repository at:
/hippo:configuration/hippo:modules/mimetype-resolution/hippo:moduleconfig
Each child node represents a file extension and has a multi-valued mimeTypes property listing all known MIME types for that extension.
Default Mappings
The service ships with default mappings for common file types:
| Category | Extensions |
|---|---|
| Images | jpg, jpeg, png, gif, webp, svg, bmp, ico, tiff, tif, avif |
| Documents | pdf, doc, docx, xls, xlsx, ppt, pptx, odt, ods, odp |
| Text | txt, csv, xml, html, htm, css, js, json |
| Archives | zip, rar, 7z, tar, gz |
| Audio | mp3, wav, ogg, m4a |
| Video | mp4, avi, mov, wmv, flv, webm |
Adding a Custom Mapping
To add a MIME type mapping for a new file extension, create a new node under the module configuration using the Console:
- Navigate to /hippo:configuration/hippo:modules/mimetype-resolution/hippo:moduleconfig
- Add a child node with the extension name (without dot) and primary type hipposys:moduleconfig
- Add a multi-valued String property mimeTypes with all known MIME types for that extension
For example, to add support for .heic files:
/hippo:moduleconfig/heic:
jcr:primaryType: hipposys:moduleconfig
mimeTypes:
- image/heic
- image/heif
Modifying an Existing Mapping
To add additional MIME type variants to an existing extension, find the extension node under the module configuration and add the new MIME type to its mimeTypes property.
Runtime Reconfiguration
Changes to the configuration are picked up automatically. There is no need to restart the application after modifying the mappings.
How It Works
When a file upload component is configured with a list of allowed file extensions, the MIME type resolution service translates those extensions into the full set of MIME types that browsers may report. This set is used to configure the client-side upload widget's accept filter.
For example, if the allowed extensions are jpg and png, the service resolves them to:
- image/jpeg, image/pjpeg (for jpg)
- image/png (for png)
The upload widget then accepts files with any of these MIME types.