git-svn: cleanup sprintf usage for uppercasing hex
[gitweb.git] / perl / Git / SVN / Utils.pm
index 4bb4dde89a3821ad7714c299b429f751cc98ebcc..3d1a0933a2eb27dc123730c67470be503e91bf93 100644 (file)
@@ -122,7 +122,6 @@ sub _canonicalize_path_ourselves {
        $path = _collapse_dotdot($path);
        $path =~ s#/$##g;
        $path =~ s#^\./## if $dot_slash_added;
-       $path =~ s#^/##;
        $path =~ s#^\.$##;
        return $path;
 }
@@ -156,7 +155,7 @@ sub _canonicalize_url_path {
 
        my @parts;
        foreach my $part (split m{/+}, $uri_path) {
-               $part =~ s/([^~\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
+               $part =~ s/([^!\$%&'()*+,.\/\w:=\@_`~-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
                push @parts, $part;
        }