Show
Ignore:
Timestamp:
07/07/08 07:41:10 (5 months ago)
Author:
rob
Message:

Fixed vfs uri handling to properly decode fragments in windows path urls
* makeTabActive now attempts to match on normalized URLs
* added testcase for windows urls with fragments

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/peppy/vfs/itools/uri/generic.py

    r1026 r1462  
    738738        scheme, authority, path, query, fragment = urlsplit(data) 
    739739         
    740         # Some special cases for Windows paths 
     740        # Some special cases for Windows paths c:/a/b#4 and file:///c:/a/b#4. 
     741        # urlsplit has problems with the scheme, leading slashes in the path, 
     742        # and doesn't split out the fragment properly 
    741743        if len(scheme) == 1: 
    742744            # found a windows drive name instead of path, because urlsplit 
    743745            # thinks the scheme is "c" for Windows paths like "c:/a/b" 
     746            if "#" in path: 
     747                # the fragment is improperly placed in the path 
     748                path, fragment = path.rsplit("#", 1) 
    744749            path = "%s:%s" % (scheme, path) 
    745750            scheme = "file" 
     
    748753            # like "file:///c:/a/b" -- it thinks the path is "/c:/a/b", which 
    749754            # to be correct requires removing the leading slash. 
    750             path = "%s:%s" % (path[1].lower(), path[3:]) 
     755            drive = path[1].lower() 
     756            path = path[3:] 
     757            if "#" in path: 
     758                path, fragment = path.rsplit("#", 1) 
     759            path = "%s:%s" % (drive, path) 
    751760         
    752761        # The path