Subject: Re: git-svn SVN 1.7 fix, take 2

From: Michael G Schwern <[email-masked]>
Date: Tue, 24 Jul 2012 22:36:55 -0700

On 2012.7.24 9:53 PM, Jonathan Nieder wrote:
> Michael G Schwern wrote:
> 
>> No, now it's just canonicalizing as early as possible.  Preferably within the
>> object accessor rather than at the point of use.  So in the code below,
>> $full_url is already escaped/canonicalized.
> 
> Let's start with this.
> 
> Is svn_path_canonicalize() idempotent?  What does it do when it
> encounters a percent-sign?

Nothing, because paths are not URI escaped. :)

You probably meant svn_uri_canonicalize().  And no, it does not double escape,
so its safe to escape as early as possible.

   use SVN::Core;

   my $uri = "http://www.example.com/ foo";

    print SVN::_Core::svn_uri_canonicalize(
        SVN::_Core::svn_uri_canonicalize($uri)
    );

That produces "http://www.example.com/%20foo".

The API docs don't say it specifically, but if it were otherwise it would be
impossible to use.  You'd have to check first if anything were escaped before
canonicalizing.  And a user couldn't pass in an escaped URL without risking it
being double escaped.

http://subversion.apache.org/docs/api/latest/svn__dirent__uri_8h.html#a8bae33a2fbf86857869f7b0e39a553e7

-- 
'All anyone gets in a mirror is themselves,' she said. 'But what you
gets in a good gumbo is everything.'
    -- "Witches Abroad" by Terry Prachett