Modify

Opened 15 years ago

Closed 2 months ago

#5302 closed defect (fixed)

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 12 years ago.
Patch to replace url2pathname and pathname2url by quote and unquote

Download all attachments as: .zip

Change History (7)

comment:1 Changed 15 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 15 years ago by rupert thurner

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

would you mind creating a patch please?

Changed 12 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 12 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 11 years ago by Ryan J Ollos

Owner: changed from rupert thurner to Ryan J Ollos

comment:5 Changed 4 years ago by Ryan J Ollos

Status: assignednew

comment:6 Changed 2 months ago by Jun Omae

Resolution: fixed
Status: newclosed

In 18641:

SvnAuthzAdminPlugin 1.0.1dev: fix fatal raising when non-ascii groups and paths used, and remove uses of pathname2url and url2pathname (closes #5484, #7871, #5302, #12314)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.