Edgewall Software

Ticket #7672 (new defect)

Opened 3 months ago

Last modified 3 months ago

Scoped repository with non-ASCII path name errors

Reported by: richard.liao.i@… Owned by: cboos
Priority: high Milestone: 0.12
Component: version control Version: 0.12dev
Severity: major Keywords: scoped repository unicode svn
Cc:

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

Change History

Changed 3 months ago by cboos

  • keywords unicode svn added
  • owner set to cboos
  • priority changed from normal to high

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 :-) )

Add/Change #7672 (Scoped repository with non-ASCII path name errors)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cboos. Next status will be 'new'
The owner will change from cboos to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.