Hello,
I recently noticed that some pdf attachments generate incorrect 'Content-Type' mime headers.
This started after upgrading from 8.8.15 to 10.0.6.
The header created is:but the correct header should be:The result is that when a user clicks to open the attachment, the pdf opens as plain text in a new tab.
At a quick glance it appears that the ZmMimeTable.isRenderable function in ZmMimeTable.js might be responsible.Does 'textOnly' check only the first x number bytes for binary data then return a boolean result?
The attached example is mostly ascii so this might be the cause.
I did verify that the zimbra user's version of 'file' correctly identifies the example as 'PDF document, version 1.3'.
To reproduce click to create a new message, attach the example (example.pdf), then click on the attachment.
Current zimbra version:
I recently noticed that some pdf attachments generate incorrect 'Content-Type' mime headers.
This started after upgrading from 8.8.15 to 10.0.6.
The header created is:
Code:
Content-Type: text/plain; name=example.pdf
Code:
Content-Type: application/pdf; name=example.pdf
At a quick glance it appears that the ZmMimeTable.isRenderable function in ZmMimeTable.js might be responsible.
Code:
ZmMimeTable.isRenderable =function(type, textOnly) { return (type === ZmMimeTable.TEXT_HTML || type === ZmMimeTable.TEXT_PLAIN || (!textOnly && ZmMimeTable.isRenderableImage(type)) || (!textOnly && type === ZmMimeTable.APP_ADOBE_PDF));
The attached example is mostly ascii so this might be the cause.
I did verify that the zimbra user's version of 'file' correctly identifies the example as 'PDF document, version 1.3'.
To reproduce click to create a new message, attach the example (example.pdf), then click on the attachment.
Current zimbra version:
Code:
Release 10.0.6.GA.0124.UBUNTU20.64 UBUNTU20_64 FOSS edition
Statistics: Posted by zmcontrol — Mon Feb 19, 2024 10:50 pm