Bratch
Bratch

Reputation: 4223

How can I serve VBS and other file types as plain text from a Subversion repository (Apache)?

I just want to browse my Subversion code repositories and view files. Some of the file types, like .VBS, prompt me to open or save the file, but I just want to view it in the browser as plain text. Can Apache's httpd.conf file be modified to do this? I don't think it would be changed on the client (IE7) because then it would work the same on all sites.

Upvotes: 1

Views: 1145

Answers (2)

Wim Coenen
Wim Coenen

Reputation: 66753

You can set the mime type of all your vbs files to text/plain by doing this in the root of your working copy:

svn propset --recursive svn:mime-type text/plain *.vbs

and then commit the changes. Explanation from the svn book on repository browsing:

To make this happen, you need only to make sure that your files have the proper svn:mime-type set. We discuss this in more detail in the section called “File Content Type”, and you can even configure your client to automatically attach proper svn:mime-type properties to files entering the repository for the first time; see the section called “Automatic Property Setting”.

So in our example, if one were to set the svn:mime-type property to text/html on file foo.html, Apache would properly tell your web browser to render the file as HTML. One could also attach proper image/* MIME-type properties to image files and ultimately get an entire web site to be viewable directly from a repository!

Upvotes: 3

Jordan S. Jones
Jordan S. Jones

Reputation: 13903

Put the following into your httpd.conf

<IfModule mime_module>
AddType text/plain .vbs
</IfModule>

Upvotes: 1

Related Questions