[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [Subclipse-users] Can't create folder with square brackets

From: Mark Phippard <markphip_at_gmail.com>
Date: Thu, 23 Oct 2014 10:01:27 -0400

On Thu, Oct 23, 2014 at 9:45 AM, David Balažic <david.balazic_at_comtrade.com>
wrote:

> I was curious and tried to reproduce the problem, but could not.
>
> I have Eclipse Kepler SR-2 (v4.3.2) with:
>
> Subclipse (Required) 1.10.5
>
> Subversion Client Adapter (Required) 1.10.1
>
> Subversion JavaHL Native Library Adapter 1.8.10
>
>
>
> With repository on VisualSVN Server 3.0.0
>
>
>
> I created , updated, viewed the log of a folder with sqaure brackets in
> its name but everything worked without error.
>
> Does the error happen in some special circumstances?
>
>
> Steve fixed this before I ever tried it. Not sure what he did to test
it. The OP mentions creating a folder. Did you try doing it against the
remote repository? It is possible you do not see this if you do it locally
and then just commit the folder.

In general, when a URL is passed to the SVN API it has to be URI-encoded.
So, as an example, we have to convert spaces to %20. Any character that
has to be converted to a %xx value has to be done this way. We handle this
in the toString() method of our SVNUrl class:

public String toString() {
            // The URI class will throw Exception if there are spaces in the
URL, but it seems // to handle other classes OK. I tested with @
+ and Unicode characters. It leaves // the @ and + alone and
converts Unicode to %nn. It is possible there are other //
characters we need to replace here besides space. String s =
get().replace(" ", "%20").replace("[", "%5B").replace("]","%5D");
                try {
                        URI u = new URI(s);
                        return u.toASCIIString();
                } catch (URISyntaxException e) {
                        return s;
                }
    }

So most of the work happens in the URI.toASCIIString() method that we
call. As the comment notes, this method does not convert spaces (and
possibly other characters). I assume that Steve confirmed that it does not
convert brackets and so he added those to the manual exceptions. I have
not checked if that is right or wrong, but that is what is needed here in
general.

SVN itself handles all of this fine internally. The only issue is when we
have to directly provide one of these URL's in an API call.

-- 
Thanks
Mark Phippard
http://markphip.blogspot.com/
------------------------------------------------------
http://subclipse.tigris.org/ds/viewMessage.do?dsForumId=1047&dsMessageId=3090358
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subclipse.tigris.org].
Received on 2014-10-23 16:01:33 CEST

This is an archived mail posted to the Subclipse Users mailing list.