[viewvc-dev] Re: [viewvc-users] Don't display binary files

"C. Michael Pilato" <[email protected]> Fri, 14 Nov 2008 10:19:53 -0500
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Organization CollabNet, Inc.
Message-ID <491D9719.9020205__19217.5303855494$1226676073$gmane$org@collab.net>
JJ wrote:
> No, that last patch I sent you doesn't add processing to determine if
> links to diff, annotate, etc. should be shown.  I was suggesting that if
> template modifiers don't want those links to be shown they can do so
> using some variable based on mime types alone.
>  
> The patch only adds the processing when actually marking up a file.  At
> that point the file is already going to be opened anyway.  I just added
> code to check the first 512 bytes to determine if it is viewable, to
> avoid the embarrassing scenario where we display a bunch of binary
> garbled characters on the page.  Granted, my code does open the file one
> additional time in the markup view.  I'd prefer it if FileContentsPipe
> could be modified so that we could open it once and check the first 512
> bytes for that test but then still reset and call readlines again on the
> already open file.
>  
> Do you think any differently about it now?  :-)

Okay, I guess I was thinking you were wanting to scan the first 512 of every
file every time the prefer_markup bit was in need of calculation.  I'll
re-examine your patch with the right frame of mind.

-- 
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJHZcZokEGqRcG/W4RAgFBAJ47yzRO9cFXqb6k7ArlEYsOENhVowCcDlBS
57axfllNy3PeZ68u0DyDwIw=
=cZJy
-----END PGP SIGNATURE-----