Modify

Opened 8 years ago

Last modified 3 years ago

#5302 assigned defect

SvnAuthzAdmin path calculations incorrect on Windows

Reported by: Chris Heller Owned by: Ryan J Ollos
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 Sergio Talens-Oliag 5 years ago.
Patch to replace url2pathname and pathname2url by quote and unquote

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by Chris Heller

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 Changed 8 years ago by rupert thurner

Owner: changed from Kis Gergely to rupert thurner
Status: newassigned

would you mind creating a patch please?

Changed 5 years ago by Sergio Talens-Oliag

Attachment: fix_svnauth_paths.patch added

Patch to replace url2pathname and pathname2url by quote and unquote

comment:3 in reply to:  2 Changed 5 years ago by Sergio Talens-Oliag

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 3 years ago by Ryan J Ollos

Owner: changed from rupert thurner to Ryan J Ollos

Modify Ticket

Action
as assigned The owner will remain Ryan J Ollos.

Add Comment


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

 
Note: See TracTickets for help on using tickets.