Edgewall Software

Opened 2 years ago

Closed 2 years ago

#13459 closed defect (fixed)

Syntax highlight doens't work for a file without svn:mime-type in Subversion repository — at Version 2

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.5.4
Component: version control/browser Version: 1.5.3
Severity: normal Keywords: svn
Cc: Branch:
Release Notes:

Fixed wrong content_type for a file in Subversion repository when svn:mime-type is not set.

API Changes:
Internal Changes:

Description

Reported at gmessage:trac-users:ZI6x6-IaY0c/m/_YhEYQHWAwAJ.

My Trac installation will not do syntax highlighting based on file extension in Subversion repository browser, only when I set it explicitly, like:

svn propset svn:mime-type "`file -bi start.pl`" start.pl

Only then syntax highlighting works, for this file only. Do I have to set this property on all files to see them highlighted?

Change History (2)

comment:1 by Jun Omae, 2 years ago

Owner: set to Jun Omae
Status: newassigned

The following patch fixes it. I'll push the patch with a test case.

  • tracopt/versioncontrol/svn/svn_fs.py

    diff --git a/tracopt/versioncontrol/svn/svn_fs.py b/tracopt/versioncontrol/svn/svn_fs.py
    index b5fd52854..bac8fa157 100644
    a b class SubversionNode(Node):  
    827827    def _get_prop(self, name):
    828828        value = fs.node_prop(self.root, self._scoped_path_utf8, name,
    829829                             self.pool)
    830         return to_unicode(value)
     830        return _from_svn(value)
    831831
    832832    def get_branch_origin(self):
    833833        """Return the revision in which the node's path was created.

comment:2 by Jun Omae, 2 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [17574].

Note: See TracTickets for help on using tickets.