Add a configuration option for telling ViewVC to *not* honor the
svn:mime-type property. * lib/config.py (Config.set_defaults): Set options.svn_ignore_mimetype default value. * viewvc.conf.dist (svn_ignore_mimetype): New. * lib/viewvc.py (calculate_mime_type): Consult cfg.options.svn_ignore_mimetype before looking up the 'svn:mime-type' property. * docs/upgrading-howto.html Add a note about the new configuration option. Patch (mostly) by: JJ <eggsgloriouseggs {_AT_} gmail.com> git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2055 8cb11bc2-c004-0410-86c3-e597b4017df7remotes/issue-366-dev
parent
bf40ef2683
commit
38a7338c9d
|
@ -293,6 +293,18 @@ td {
|
|||
<li>options/allow_tar</li>
|
||||
</ul>
|
||||
|
||||
<p>ViewVC now honors the "svn:mime-type" property stored on
|
||||
Subversion-versioned files as the primary source of MIME type
|
||||
determination (before falling back to name-based MIME mappings and
|
||||
such). However, this can negatively affect the viewability of
|
||||
certain files — especially images — whose
|
||||
"svn:mime-type" properties are set incorrectly, such as will happen
|
||||
if Subversion itself merely determines that the file isn't
|
||||
human-readable and uses the "application/octet-stream" MIME type to
|
||||
record this determination. To make ViewVC <em>not</em> honor the
|
||||
"svn:mime-type" property value, set the <code>svn_ignore_mimetype</code>
|
||||
configuration option.</p>
|
||||
|
||||
<p>The <code>use_rcsparse</code> option was moved from the "general"
|
||||
section to the "options" section.</p>
|
||||
|
||||
|
|
|
@ -219,6 +219,7 @@ class Config:
|
|||
self.options.default_file_view = "log"
|
||||
self.options.http_expiration_time = 600
|
||||
self.options.generate_etags = 1
|
||||
self.options.svn_ignore_mimetype = 0
|
||||
self.options.svn_config_dir = None
|
||||
self.options.use_rcsparse = 0
|
||||
self.options.sort_by = 'file'
|
||||
|
|
|
@ -1465,7 +1465,8 @@ def calculate_mime_type(request, path_parts, rev):
|
|||
mime_type = None
|
||||
if not path_parts:
|
||||
return None
|
||||
if request.roottype == 'svn':
|
||||
if request.roottype == 'svn' \
|
||||
and (not request.cfg.options.svn_ignore_mimetype):
|
||||
try:
|
||||
itemprops = request.repos.itemprops(path_parts, rev)
|
||||
mime_type = itemprops.get('svn:mime-type')
|
||||
|
|
|
@ -332,6 +332,13 @@ http_expiration_time = 600
|
|||
# 0 Don't generate Etags
|
||||
generate_etags = 1
|
||||
|
||||
# Don't use the svn:mime-type property to determine how to display a
|
||||
# file in the markup view. This is especially helpful when versioned
|
||||
# images carry the default Subversion-calculated MIME type of
|
||||
# "application/octet-stream" (which isn't recognized as viewable type
|
||||
# by browsers).
|
||||
svn_ignore_mimetype = 0
|
||||
|
||||
# svn_config_dir: Path of the Subversion runtime configuration
|
||||
# directory ViewVC should consult for various things, including cached
|
||||
# remote authentication credentials. If unset, Subversion will use
|
||||
|
|
Loading…
Reference in New Issue