OTRS6 - Attachment filename/ext affects inline vs download

Moderator: crythias

Post Reply
e5j
Znuny newbie
Posts: 2
Joined: 29 Jun 2018, 00:04
Znuny Version: 5.0.20
Real Name: Jeff Johnson

OTRS6 - Attachment filename/ext affects inline vs download

Post by e5j »

Sorry for the confusing subject line...

Running OTRS 6.0.8. I have two tickets, each with an attachment. One is 10923456.PDF and the other is failed_thing.pdf

In ticket view...

failed_thing.pdf when clicked shows in the browser

10923456.PDF when clicked becomes a download that must be downloaded, saved and opened to read.

I have the system config set to inline for attachments. I cannot determine what OTRS is looking for in the email in the ticket that determines whether it functions as line or download. Looking at the html for both they appear to have the same values in the html.

Working

Code: Select all

<div id="TicketAttachment14368" class="AttachmentData Hidden">
    <div class="Attachment InnerContent">
        
        <div class="AttachmentElement">
            <h3>
                <a href="/otrs/index.pl?Action=AgentTicketAttachment;TicketID=3616;ArticleID=14368;FileID=1" target="attachment" >failed_thing.pdf</a>
            </h3>
            <p></p>
        </div>
            
        
    </div>
</div>
...
 <ul class="ArticleAttachments">
                
                    <li title="failed_thing.pdf">
                        <h5>failed_thing.pdf</h5>
                        
                            Unknown
                        
                        &ndash;
                        136.9 KB
                        <div>
                        
                            
                            <a class="" href="/otrs/index.pl?Action=AgentTicketAttachment;TicketID=3616;ArticleID=14368;FileID=1" title="Download failed_thing.pdf" target="attachment" >
                                <i class="fa fa-download"></i>
                            </a>
                            
Not working

Code: Select all

<div id="TicketAttachment14433" class="AttachmentData Hidden">
    <div class="Attachment InnerContent">
        
        <div class="AttachmentElement">
            <h3>
                <a href="/otrs/index.pl?Action=AgentTicketAttachment;TicketID=3624;ArticleID=14433;FileID=1" target="attachment" >10923456.PDF</a>
            </h3>
            <p></p>
        </div>
            
        
    </div>
</div>
...
                <ul class="ArticleAttachments">
                
                    <li title="10923456.PDF">
                        <h5>10923456.PDF</h5>
                        
                            Unknown
                        
                        &ndash;
                        18.6 KB
                        <div>
                        
                            
                            <a class="" href="/otrs/index.pl?Action=AgentTicketAttachment;TicketID=3624;ArticleID=14433;FileID=1" title="Download 10923456.PDF" target="attachment" >
                                <i class="fa fa-download"></i>
                            </a>
                            
So can anyone tell me....
  1. Why does failed_thing.pdf open inline in the browser but 10923456.PDF downloads without displaying inline?
  2. Both show as "Unknown" with a size. Is there a filetype table or hash somewhere in OTRS that determines a file type?
  3. Is it the case of the suffix? pdf vs PDF?
Thanks to all who take the time to read and consider this question. My goal is to get all text, pdf, jpg, png, etc working as inline viewable.

--Jeff
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: OTRS6 - Attachment filename/ext affects inline vs download

Post by reneeb »

This depends on the content type that is stored for the attachment. How were these attachments sent to the system? Mail? Were the tickets created in the web UI? If a mail with an attachment declares the content type to be "application/octet-stream", the attachment will be downloaded. If the content type is "application/pdf" (or something alike) the attachment is shown in the browser...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
e5j
Znuny newbie
Posts: 2
Joined: 29 Jun 2018, 00:04
Znuny Version: 5.0.20
Real Name: Jeff Johnson

Re: OTRS6 - Attachment filename/ext affects inline vs download

Post by e5j »

Interesting. The tickets are generated by inbound email.

So does the inbound email cause some cell in the MySQL table for that ticket message to be set as online or download? Or is it based on the raw email content as it’s saved inside the database? I ask because I’d test it by going in an editing the type info to see if it triggers the inline behavior.

Makes me wonder if I could write some rule or filter to rewrite the type designation on inbound emails to make them inline compliant.

The save and go fetch/open attachments is a time suck.

Thanks!!
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: OTRS6 - Attachment filename/ext affects inline vs download

Post by reneeb »

You can enable the "PlainView" in the system configuration. Then you can open the tickets and you'll get an "Unformatted view" link for each article. There you can see the plain mail that was received by OTRS. Look at those mails and you'll see what content types were defined in the mails for the attachments.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Post Reply