Quantcast
Channel: Zimbra Forums
Viewing all articles
Browse latest Browse all 1011

Administrators • Incorrect Content Type for some pdf attachments

$
0
0
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:

Code:

Content-Type: text/plain; name=example.pdf
but the correct header should be:

Code:

Content-Type: application/pdf; name=example.pdf
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.

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));
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:

Code:

Release 10.0.6.GA.0124.UBUNTU20.64 UBUNTU20_64 FOSS edition
example.zip

Statistics: Posted by zmcontrol — Mon Feb 19, 2024 10:50 pm



Viewing all articles
Browse latest Browse all 1011

Trending Articles