Login | Register
My pages Projects Community openCollabNet

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

subclipse
Discussion topic

Back to topic list

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

Author markphip
Full name Mark Phippard
Date 2014-10-24 06:07:45 PDT
Message We tried techniques like those once but they are encoding the URL the way a
browser form POST wants to do it, not the way Subversion expects it. I
will try to find the RFC that Subversion is following and see if I can find
something better, but we have done this in the past. We obviously would
prefer to call a method someone else wrote that does this correctly.

On Fri, Oct 24, 2014 at 8:02 AM, David Balažic <david.balazic@co​mtrade.com>
wrote:

> Maybe some of the possibilities mentioned here:
> http://stackoverflow​.com/a/16226168/8228​70
>
>
>
> David Balažic
>
> Software Engineer
>
> www.comtrade.com
>
>
>
> *From:* Mark Phippard [mailto:markphip at gmail dot com]
> *Sent:* 24. October 2014 13:12
>
> *To:* users at subclipse dot tigris dot org
> *Subject:* Re: [Subclipse-users] Can't create folder with square brackets
> *Importance:* Low
>
>
>
> Is it not pretty clear already that is what we have tried to do? Find one
> better and let us know.
>
>
> On Oct 24, 2014, at 7:05 AM, David Balažic <david.balazic@co​mtrade.com>
> wrote:
>
> Yes, there it reproduces for me too. (trying to create a folder in the
> »SVN Repository Exploring« perspective)
>
>
>
> I updated to subclipse 1.10.6 and now the characters [ and ] work, but
> others still don't, like # or %.
>
>
>
> I suggest using an existing encoding method instead of reinventing the
> wheel, because »home made« solutions are always full of problems like these.
>
>
>
> Regards,
>
> David Balažic
>
> Software Engineer
>
> www.comtrade.com
>
>
>
> *From:* Stephen Elsemore [mailto:selsemore at collab dot net
> <selsemore at collab dot net>]
> *Sent:* 23. October 2014 16:07
> *To:* users at subclipse dot tigris dot org
> *Subject:* Re: [Subclipse-users] Can't create folder with square brackets
> *Importance:* Low
>
>
>
> I was able to reproduce the problem by right clicking a folder in the SVN
> Repositories view, selecting New -> New remote folder, and then trying to
> add a folder with square brackets in the name. I got:
>
> org.apache.subversio​n.javahl.ClientExcep​tion: Bogus URL svn: URL
> 'myurlwithbrackets' is not properly URI-encoded
>
> I got similar errors if I tried to show history for a folder or file with
> square brackets in the name.
>
>
>
> On Thu, Oct 23, 2014 at 4:01 PM, Mark Phippard <markphip at gmail dot com> wrote:
>
> On Thu, Oct 23, 2014 at 9:45 AM, David Balažic <david.balazic@co​mtrade.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/
>
>
>
>


--
Thanks

Mark Phippard
http://markphip.blogspot.com/
Attachments

« Previous message in topic | 9 of 9 | Next message in topic »

Messages

Show all messages in topic

[Subclipse-users] Can't create folder with square brackets Lukáš Cek <cek at kadel dot cz> Lukáš Cek <cek at kadel dot cz> 2014-10-21 01:06:31 PDT
     RE: [Subclipse-users] Can selsemore Stephen Elsemore 2014-10-21 04:09:24 PDT
     RE: [Subclipse-users] Can't create folder with square brackets David Balažic <david dot balazic at comtrade dot com> David Balažic <david dot balazic at comtrade dot com> 2014-10-23 06:45:49 PDT
         Re: [Subclipse-users] Can't create folder with square brackets markphip Mark Phippard 2014-10-23 07:01:29 PDT
             Re: [Subclipse-users] Can't create folder with square brackets selsemore Stephen Elsemore 2014-10-23 07:07:09 PDT
                 RE: [Subclipse-users] Can't create folder with square brackets David Balažic <david dot balazic at comtrade dot com> David Balažic <david dot balazic at comtrade dot com> 2014-10-24 04:05:55 PDT
                     Re: [Subclipse-users] Can't create folder with square brackets markphip Mark Phippard 2014-10-24 04:11:51 PDT
                         RE: [Subclipse-users] Can't create folder with square brackets David Balažic <david dot balazic at comtrade dot com> David Balažic <david dot balazic at comtrade dot com> 2014-10-24 05:02:27 PDT
                             Re: [Subclipse-users] Can't create folder with square brackets markphip Mark Phippard 2014-10-24 06:07:45 PDT
Messages per page: