Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#7672 closed defect (fixed)

Scoped repository with non-ASCII path name errors

Reported by: richard.liao.i@… Owned by: Christian Boos
Priority: high Milestone: 0.11.3
Component: version control Version: 0.12dev
Severity: major Keywords: scoped repository unicode svn
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When I config trac using scoped repository, which path name contains non-ascii characters, will raise UnicodeDecodeError in trac-admin resync and browser:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position
8: ordinal not in range(128)

Test in trac 0.10.4, 0.11 and 0.12, all have the same problem.

Here is the patch:

Index: svn_fs.py
===================================================================
@@ -111,7 +111,7 @@
    """Check whether the given `fullpath` is within the given
`scope`"""
    if scope == '/':
        return fullpath is not None
-    fullpath = fullpath and fullpath.lstrip('/') or ''
+    fullpath = to_unicode(fullpath and fullpath.lstrip('/') or '')
    scope = scope.strip('/')
    return (fullpath + '/').startswith(scope + '/')

@@ -404,7 +404,7 @@
        Repository.__init__(self, name, authz, log)

        if self.path != path:
-            self.scope = path[len(self.path):]
+            self.scope = to_unicode(path[len(self.path):])
            if not self.scope[-1] == '/':
                self.scope += '/'
        else:

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 16 years ago

Keywords: unicode svn added
Owner: set to Christian Boos
Priority: normalhigh

Well, yes, I see the bug: self.scope is sometimes supposed to be utf-8 str, sometimes unicode. We need to clarify what is supposed to be kept as utf-8 and what not, in a more explicit way.

([OT] and yes, to add some weight to #7018, I just found myself entering "unicode svn" in the Cc: field :-) )

comment:2 by Christian Boos, 16 years ago

Milestone: 0.120.11.3
Resolution: fixed
Status: newclosed

Was incidentally fixed during the r7842 clean-up.

comment:3 by Christian Boos, 16 years ago

Needed follow-up fix r7884 and modified the tests so that they take care of this condition as well (r7885).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.