#1920 closed defect (fixed)
attached binary files get displayed as HTML preview
Reported by: | vittorio | Owned by: | Jonas Borgström |
---|---|---|---|
Priority: | high | Milestone: | 0.9 |
Component: | general | Version: | devel |
Severity: | major | Keywords: | regression attachment |
Cc: | vittorio@…, vyt@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
some binary files attached to tickets or wiki pages get displayed as HTML preview. others dont. i couldnt find out why some files get displayed as HTML preview, so i will attach some.
using trunk r2068
Attachments (2)
Change History (15)
by , 19 years ago
Attachment: | XPLA3_errata.pdf added |
---|
comment:1 by , 19 years ago
it looks like all attachments (<256kB) are displayed as HTML preview now in trunk r2068. some with an empty preview box though. this wasnt the case with trunk r1739 when i have seen the problem for the first time. there some got displayed as preview, some correctly offered a "download this file" link only.
comment:2 by , 19 years ago
Milestone: | → 0.9 |
---|
comment:3 by , 19 years ago
Cc: | added |
---|---|
Keywords: | attachment added |
comment:6 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I don't think that we should be using special exceptions for certain mimetypes to treat as binary. The mimetypes are classified as "text/" or "application/" to help make this distinction. I think that we should only provide textual previews for mimetypes that begin with "text/".
comment:7 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
[2113] will only use the PlainTextRenderer for mimetypes that are textual.
comment:8 by , 19 years ago
The problem with [2113] is that now files with types such as "application/xhtml+xml" or "application/xml" will not be displayed by Trac unless SilverCity or Enscript is installed. Not sure if that's acceptable.
comment:9 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Yes, I was about to write something similar
Well, what about:
image/x-xpixmap
(XPM files)- the various
application/*+xml
(*
=xhtml
,rdf
,svg
, etc.) - the various
application/x-*
) (*
= some programming language, likecsh
,sh
, etc.)
That's why we had the is_binary
heuristic.
Please consider reverting r2113.
comment:10 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed in [2179], doing the check in get_quality_ratio
as suggested.
comment:11 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I don't think this is a solution. There are many files that are not binary but also not useful in plaintext. And there are many files that are useful in plaintext but are not in the text/ group.
I think it would be better to offer the user both options view and download right in the attachments list. The default should be what the mime-type dictates. For binary files (heuristic) the view-option could be hidden or deactivated. For files in the image/ group the view-option should be activated and mean "view as image".
comment:12 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Images are already handled by another mime viewer and will be displayed appropriately. The ticket is just regarding types that Trac tries to display as plaintext that it shouldn't. If there are other file types that are inappropriately displayed as plaintext you can reopen this ticket for those types, but comments on other mime-viewer related topics should be made on the appropriate ticket, or a new ticket if necessary.
pdf gets displayed as HTML preview