RE: [Subclipse-users] Can't create folder with square brackets
From: David Balažic <david.balazic_at_comtrade.com>
Date: Fri, 24 Oct 2014 14:02:22 +0200
Maybe some of the possibilities mentioned here: http://stackoverflow.com/a/16226168/822870
David Balažic
From: Mark Phippard [mailto:markphip_at_gmail.com]
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_at_comtrade.com<mailto:david.balazic_at_comtrade.com>> wrote:
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,
From: Stephen Elsemore [mailto:selsemore_at_collab.net]
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:
On Thu, Oct 23, 2014 at 4:01 PM, Mark Phippard <markphip_at_gmail.com<mailto:markphip_at_gmail.com>> wrote:
I was curious and tried to reproduce the problem, but could not.
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.
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=3090397 To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subclipse.tigris.org].Received on 2014-10-24 14:02:32 CEST |
This is an archived mail posted to the Subclipse Users mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.