Modify

Opened 5 years ago

Last modified 9 months ago

#5302 assigned defect

SvnAuthzAdmin path calculations incorrect on Windows

Reported by: chrisheller Owned by: rjollos
Priority: normal Component: SvnAuthzAdminPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

SvnAuthzAdminPlugin uses Python's url2pathname() function to go from the current URL to the relative path in the svn authz file format.

The svn authz format is always with URL or Unix style paths ('/' instead of '\'), so when using this plugin on Windows, the path calculations are incorrect.

Attachments (1)

fix_svnauth_paths.patch (5.2 KB) - added by sto 2 years ago.
Patch to replace url2pathname and pathname2url by quote and unquote

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by chrisheller

What I did to get around this issue is to add the following at the top of the admin_ui.py file.

import sys
is_windows = sys.platform.startswith('win')
del sys

def url2localpathname(url):
    """ 
    Fix up paths returned by url2pathname so that authz format is correct 
    on Windows as well as *nix flavors
    """
    localpath = url2pathname(url)
    if is_windows:
        localpath = localpath.replace('\\', '/')
    return localpath    

and then change all other references to url2pathname to use the newly defined url2localpathname

comment:2 follow-up: Changed 5 years ago by ThurnerRupert

  • Owner changed from kisg to ThurnerRupert
  • Status changed from new to assigned

would you mind creating a patch please?

Changed 2 years ago by sto

Patch to replace url2pathname and pathname2url by quote and unquote

comment:3 in reply to: ↑ 2 Changed 2 years ago by sto

Replying to ThurnerRupert:

would you mind creating a patch please?

I've created a different patch
replacing the use of url2pathname and pathname2url by quote and
unquote, as that is what is needed to process the svnauth paths
(in UNIX systems the functions url2pathname and pathname2url are
equivalent to quote and unquote and the svnauth file uses UNIX
like paths, so we don't need to use the system dependent functions).

comment:4 Changed 9 months ago by rjollos

  • Owner changed from ThurnerRupert to rjollos

Add Comment

Modify Ticket

Action
as assigned .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.