Show PDF in new tab

I need to explicitly show PDFs in a new tab instead of downloading them. I refer to the ticket PDF attachments should not be opened without downloading them first · Issue #4479 · zammad/zammad · GitHub as this is somehow intended and was introduced in a new config entry.

Configuration at config/initializers/content_type_allowed_inline.rb is set to explicitly push application/pdf to config:

Rails.application.config.active_storage.content_types_allowed_inline.push(‘application/pdf’)

But somehow PDF files still get a parameter “disposition=attachment” instead of “disposition=inline”.

How can I fix this?

In the end this is more a browser thing. Zammad tries here to be secure, but I think you can influence the open inline or download behavior in the browser configuration.

@dominikklein this is basically not a browser thing at all as the header is sent by the server and the browser behaves like expected (disposition attachment is send by the server, so the browser will download the file instead of showing it, no matter of file type)

So this should be configurable or at least should respect the settings in the active storage. When I add the parameter ?disposition=inline instead of ?disposition=attachment to the asset, it works like expected. But this is nothing I can change myself without forking Zammad as it is hard coded as it seems?

Like I explained, Zammad wants to be secure here.
And about the browser I only want to say, that you can more or less force to open it in the browser directly, but then it’s not in the zammad context (and for sure first download the file).

1 Like