-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encode path segments in urls to prevent illegal uris #124
base: master
Are you sure you want to change the base?
Conversation
Jesse, I think we may try to solve the problem definitively using the URI ( What do you think? Cheers, 2014-04-24 8:45 GMT+02:00 Jesse Eichar [email protected]:
Dott. carlo cancellieri |
It was I admit a fairly quick hack I put together to solve my probably. I Jesse On Mon, Apr 28, 2014 at 11:57 AM, Carlo Cancellieri <
|
great, thanks. |
…names with spaces. I have a geoserver instance where users can publish layers to the geoserver. Because there are so many users that can publish to the geoserver we have been unable to prevent them from publishing layers with spaces in the names. When there are spaces (or other certain characters), the rest api is broken because the urls have spaces in them. Obviously the best solution is to fix Geoserver so that a layer with a space in the name (or in the workspace name) does not break the REST API. However that is a substantial amount of work and this change makes this library more robust in the face or inconsiderate geoserver administrators so I decided to make the change here. When I have time I would like to patch Geoserver as well but that is another issue.
I have made the suggested change. Now new URI(...) is used to construct a correctly escaped URI. Kind of silly I didn't think of that the first time because I had done just that perhaps a day before writing the first draft. |
Jesse,
Well, I'm waiting for an updated pull req to merge.
Dott. carlo cancellieri |
When I did a git amend and forced pushed the change so when I looked at the Because I did an amend you can't really see the changes I made just the new Jesse On Tue, May 6, 2014 at 10:16 AM, Carlo Cancellieri <[email protected]
|
Hi,
Oh, yes, sorry I didn't catch the changes. I'm not sure why you are manually split the url, I think we can just replace the call to the encodeUrl method with the "new URI(String )" constructor. don't you think so? |
I can't just use new URI because it will give uri syntax exceptions. The new URI("http://path with spaces") The encoding only correctly occurs when you break the URL apart and use one new URI(protocol, authority, path, query, fragment) or new URI(protocol, host, port, path, query, fragment) I wish I could use new URI(String) that would have made my life much Jesse On Tue, May 6, 2014 at 11:06 AM, Carlo Cancellieri <[email protected]
|
ok, thanks for clarifying it. |
I have a geoserver instance where users can publish layers to the geoserver. Because there are so many users that can publish to the geoserver we have been unable to prevent them from publishing layers with spaces in the names. When there are spaces (or other certain characters), the rest api
is broken because the urls have spaces in them.
Obviously the best solution is to fix Geoserver so that a layer with a space in the name (or in the workspace name) does not break the REST API. However that is a substantial amount of work and this change makes this library more robust in the face or inconsiderate geoserver
administrators so I decided to make the change here. When I have time I would like to patch Geoserver as well but that is another issue.
The fix I have made is quite simple. In HttpUtils I separate each url into its path segments and encode each segment then put the url back together again. Because of this all urls will work regardless of the workspace or layer name.