Feature #44460
openShow the content type of attachments on the attachment preview page
Description
This patch shows the content type of an attachment on the attachment preview page. It appears after the author and the date, for example "(application/pdf)".

Besides the file name, the content type helps users understand what kind of file an attachment is, especially when the extension is generic or unfamiliar. For example, a .dat file that is actually an SQLite database is shown as application/x-sqlite3, and a .xdw file is shown as application/vnd.fujixerox.docuworks.
The content type helps users notice when a file's extension does not match its contents. Before #43484, Redmine saved the content type sent by the browser, which is usually based on the extension. Now Redmine detects the content type mainly from the file contents. For example, an image saved from a website as photo.jpg is sometimes a WebP image, and is shown as image/webp.
The content type also helps find out why some Illustrator files are previewed and others are not. #44362 added a preview for Illustrator files, but only for files whose content type is application/illustrator. Illustrator files saved without PDF compatibility are detected as application/postscript, so they are not previewed. Illustrator files uploaded before #43484 are not previewed either, even if they are PDF compatible, because many browsers send application/postscript for all .ai files. Although this patch does not change which files are previewed, the displayed content type helps identify the cause.
Files
Related issues
Updated by Go MAEDA about 2 hours ago
- Related to Feature #43484: Detect attachment content type from file contents instead of trusting client-provided values added
- Related to Feature #44362: Preview PDF compatible Adobe Illustrator files added