Edgewall Software

Ticket #2974 (closed defect: wontfix)

Opened 2 years ago

Last modified 22 months ago

Attachments Fooling Browsers

Reported by: anonymous Owned by: cboos
Priority: normal Milestone:
Component: general Version: 0.9.4
Severity: normal Keywords: attachment file preview
Cc:

Description

I am using 0.9.4 and it appears there is a problem with some browsers and attachments. When you click on an attachment like a pdf, it first presents an html page to let you know you should download the following link.

The problem is that this html page ends with the name of the attachment and not-so-bright systems sometimes interpret this as the filetype indicator hence, a .pdf will be handed to a pdf viewer.

O.K. some systems are not so bright, but I think it wouldn't be hard to alter trac so that any page that is definitely html ends with .html

Attachments

pdfattachment.patch (3.2 kB) - added by cboos 2 years ago.
Possible fix for the issue, patch on source:trunk@3288 (take 2)
browser_html_txt.patch (5.6 kB) - added by cboos 2 years ago.
Similar patch, this time for the TracBrowser.
pdf_attachment_browser.diff (19.7 kB) - added by cboos 2 years ago.
combined and updated patch (i.e. the approach pushed to the extreme :) )

Change History

Changed 2 years ago by cmlenz

What kind of “not-so-bright” system are you talking about here?

Changed 2 years ago by Corley.Kinnane@…

Someone using Firefox on a Windows machine - details later - probably using the suffix to determine mime-type.

If the html for presenting a download of a binary ended in .html or .htm then it could never happen.

Changed 2 years ago by eblot

I confirm this is a real issue with Firefox - and extensions such as PDF Download.

The trouble is that the link is presented as a .PDF file, whereas the link points on an HTML page. Several web clients expect a .PDF file, but do receive text/html data stream. Many web clients therefore save the received HTML content inside a .PDF file with the name of the original attached file. wget does...

Changed 2 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • milestone set to 0.10

Here's a possible fix for the issue, which is based on r3288: attachment:pdfattachment.patch

I verified that it works well for viewing PDF files using Firefox, while the PDF Download extension was active.

Changed 2 years ago by cboos

Possible fix for the issue, patch on source:trunk@3288 (take 2)

Changed 2 years ago by cboos

  • keywords attachment file preview added; Attachment Extension removed

... and I just realized that the same problem exists for .pdf files in the repository. Maybe the same kind of fix can be done for the TracBrowser.

Changed 2 years ago by cboos

Similar patch, this time for the TracBrowser.

Changed 2 years ago by cboos

In attachement:browser_html_txt.patch, I think I also solved the issue for the TracBrowser.

The principle is similar:

  • adding the .html suffix when rendering a preview for a file in the repository
  • adding the .txt suffix when sending it plaintext; note that this should also be done for attachments, in the first patch.
  • adding nothing when viewing the raw file.

Also note that I didn't do the required change besides from the browser.py file, so it's certainly the case that there are other browser links that will need to be modified.

Now, in order to generalize the addition of a suffix in everycase but the raw format, I think we need to consider that when we generalize #2296 to attachments and to the source browser, perhaps by using the key argument as the suffix (and rename key to format or extension?).

Changed 2 years ago by cboos

I'd like to get some feedback on this one: what I implemented in attachment:browser_html_txt.patch actually solves the issue, but I'm not very fond of the solution. In particular, I don't like the fact that the URLs are not intuitive anymore.

I'm not sure if there's another approach that could be tried to solve this, so at that point I'd rather advice to disable the PDF Download extension and to leave things as they are (i.e. wontfix).

Changed 2 years ago by cboos

combined and updated patch (i.e. the approach pushed to the extreme :) )

Changed 2 years ago by cboos

  • milestone 0.10 deleted

Changed 2 years ago by cboos

  • status changed from assigned to closed
  • resolution set to wontfix

Reiterating what I said above, I'd rather advice to disable the PDF Download extension and to leave things as they are.

Changed 22 months ago by cboos

  • status changed from closed to reopened
  • resolution wontfix deleted
  • milestone set to 0.11

r4242 implemented something like attachment:browser_html_txt.patch, but in a cleaner way.

I'll do something similar for attachments.

Changed 22 months ago by cboos

  • status changed from reopened to closed
  • resolution set to fixed

Done in r4246.

Changed 22 months ago by cboos

  • status changed from closed to reopened
  • resolution fixed deleted

Oops, re-reading the original description of this ticket, it seems that r4246 probably won't help with the original problem. I mistakenly thought this ticket was the same as #3083 but for attachments...

Changed 22 months ago by cboos

  • status changed from reopened to closed
  • resolution set to wontfix
  • milestone 0.11 deleted

... so I'm restoring this one to its original resolution!

Add/Change #2974 (Attachments Fooling Browsers)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.