[Geoserver-devel] Escape whitespace when adding an existing shapefile

Hi,

I think I have found an issue with the Geoserver REST API when it comes to escaping shapefile names containing a whitespace.

Here is an example,

Using the shapefile attached, execute the following

curl -v -u admin:password -XPUT -H "Content-type: text/plain" -d "file:///tmp/tasmania roads.shp" http://localhost:8080/geoserver/rest/workspaces/topp/datastores/test/external.shp

I would expect to see a new layer called "tasmania roads" in a new datastore called "test" in the "topp" workspace.

The workspace and datastore are fine however the layer is called "tasmania%20roads". This is turn breaks the layer preview with Geoserver returning the error,
"Could not find layer topp:tasmania roads"

I have had a look at the issues currently lodged in Jira and it appears that there are no open tickets for this issue however the two issues linked below seem to have the same theme of escaping REST URLs.

http://jira.codehaus.org/browse/GEOS-4140
http://jira.codehaus.org/browse/GEOS-3755

Cheers
Ben

------------------------------------
Ben Khoo
Gaia Resources
p +61 8 9227 7309
w www.gaiaresources.com.au
e ben.khoo@anonymised.com

(attachments)

Archive.zip (4.92 KB)

Escaping URLs is a common concern that appears almost every time we touch a file system or URL. :slight_smile:

Please open a new ticket for this one - there should be a “component” for rest config.

This month is a great time to help with testing, we have a release candidate going out next week and would love a hand looking at this (and any other issues).

Jody

···

Jody Garnett

On Tue, Aug 12, 2014 at 2:41 AM, Ben Khoo <benk@anonymised.com> wrote:

Hi,

I think I have found an issue with the Geoserver REST API when it comes to escaping shapefile names containing a whitespace.

Here is an example,

Using the shapefile attached, execute the following

curl -v -u admin:password -XPUT -H “Content-type: text/plain” -d “file:///tmp/tasmania roads.shp” http://localhost:8080/geoserver/rest/workspaces/topp/datastores/test/external.shp

I would expect to see a new layer called “tasmania roads” in a new datastore called “test” in the “topp” workspace.

The workspace and datastore are fine however the layer is called “tasmania%20roads”. This is turn breaks the layer preview with Geoserver returning the error,
“Could not find layer topp:tasmania roads”

I have had a look at the issues currently lodged in Jira and it appears that there are no open tickets for this issue however the two issues linked below seem to have the same theme of escaping REST URLs.

http://jira.codehaus.org/browse/GEOS-4140
http://jira.codehaus.org/browse/GEOS-3755

Cheers
Ben


Ben Khoo
Gaia Resources
p +61 8 9227 7309
w www.gaiaresources.com.au
e ben.khoo@anonymised.com



Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel