[issue34276] urllib.parse doesn't round-trip file URI's with multiple leading slashes

Karthikeyan Singaravelan report at bugs.python.org
Mon Jul 30 09:07:48 EDT 2018


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

I just checked back the behavior on Perl's https://github.com/libwww-perl/URI/ . It seems to handle that along with other additional cases. Maybe some of the tests can be adopted from there for better coverage too (https://github.com/libwww-perl/URI/blob/master/t/split.t)

$ cat bpo34276.pl
use URI::Split qw(uri_split uri_join);

sub print_url{
    my $uri = shift;
    print "original uri ", $uri, "\n";
    ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
    $uri = uri_join($scheme, $auth, $path, $query, $frag);
    print "returned uri ", $uri, "\n";
}

print_url("file://root/a");
print_url("file:///root/a");
print_url("file:////root/a");
print_url("file://///root/a");

$ perl bpo34276.pl
original uri file://root/a
returned uri file://root/a
original uri file:///root/a
returned uri file:///root/a
original uri file:////root/a
returned uri file:////root/a
original uri file://///root/a
returned uri file://///root/a


Thanks

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34276>
_______________________________________


More information about the Python-bugs-list mailing list