Re: [viewvc-dev] ViewVC download link not behaving as expected

"C. Michael Pilato" <[email protected]> Wed, 25 Aug 2010 11:22:23 -0400
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Organization CollabNet, Inc.
Message-ID <[email protected]>
On 08/20/2010 08:09 PM, Jeremiah Engelman wrote:
> I was receiving a lot of grief from co-workers because ViewVC's 
> download link did not behave as expected (like the download link in 
> cvsweb). Some of their binaries don't have extensions, so it wasn't 
> possible to manually handle the mime type.
> 
> I tried solving this problem months ago, but made no progress (I don't 
> know anything about writing code).
> 
> I made a change today that seems to make everything work the way one 
> would expect. I changed the default mime type from 'text/plain' to 
> 'application/octet-stream' in the viewvc.py file at line 2581.
> 
> I'm sure this isn't the best way to handle it, but its what I've come up 
> with.
> 
> Now the download links always ask to download. The 'as text' links still 
> load in the browser. Tested with IE8 and FF3.5.

I can see how this would work in your situation.  It causes ViewVC to behave
inconsistently with the Apache web server, whose own default mime type is
text/plain.  But what good is open-source good if you can't bend it to your
will, right?  :-)

> I got to this by looking at a patch written a long time ago to add a 
> Content-Disposition header I found near the bottom of the page at:
> http://permalink.gmane.org/gmane.comp.version-control.viewvc.user/638

I've been thinking about that Content-Disposition header patch some.  I
believe that truly is the correct way to get browsers to do a real
"download" regardless of a file's type.  But many people get value from the
fact that ViewVC *doesn't* force you to download web-friendly file types.
They serve version-controlled webpages directly from ViewVC!  Maybe this
behavior could be optional.

-- 
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2651253

To unsubscribe from this discussion, e-mail: [[email protected]].
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkx1NS8ACgkQokEGqRcG/W76TQCfThNKFdEoi8ckMeAkEoij1/Bq
KJgAnAgRTBvkvsszeMCDlFkP2rk8fHQ4
=UrZZ
-----END PGP SIGNATURE-----