如何从Subversion存储库(Apache)中将VBS和其他文件类型作为纯文本提供?

时间:2022-10-05 21:18:02

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.

我只是想浏览我的Subversion代码库和查看文件。某些文件类型(如.VBS)提示我打开或保存文件,但我只想在浏览器中以纯文本格式查看。是否可以修改Apache的httpd.conf文件来执行此操作?我不认为它会在客户端(IE7)上更改,因为它会在所有站点上工作相同。

2 个解决方案

#1


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

您可以在工作副本的根目录中将所有vbs文件的mime类型设置为text / plain:

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

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

然后提交更改。关于存储库浏览的svn书中的解释:

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”.

要实现这一点,您只需要确保您的文件具有正确的svn:mime-type集。我们在“文件内容类型”一节中更详细地讨论了这一点,您甚至可以将客户端配置为自动将正确的svn:mime-type属性附加到第一次进入存储库的文件中;请参阅“自动属性设置”一节。

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!

因此,在我们的示例中,如果要将文件foo.html上的svn:mime-type属性设置为text / html,Apache会正确告诉您的Web浏览器将文件呈现为HTML。还可以将正确的image / * MIME类型属性附加到图像文件,并最终使整个网站可以直接从存储库中查看!

#2


Put the following into your httpd.conf

将以下内容放入httpd.conf中

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

#1


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

您可以在工作副本的根目录中将所有vbs文件的mime类型设置为text / plain:

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

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

然后提交更改。关于存储库浏览的svn书中的解释:

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”.

要实现这一点,您只需要确保您的文件具有正确的svn:mime-type集。我们在“文件内容类型”一节中更详细地讨论了这一点,您甚至可以将客户端配置为自动将正确的svn:mime-type属性附加到第一次进入存储库的文件中;请参阅“自动属性设置”一节。

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!

因此,在我们的示例中,如果要将文件foo.html上的svn:mime-type属性设置为text / html,Apache会正确告诉您的Web浏览器将文件呈现为HTML。还可以将正确的image / * MIME类型属性附加到图像文件,并最终使整个网站可以直接从存储库中查看!

#2


Put the following into your httpd.conf

将以下内容放入httpd.conf中

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