GeoServer
  1. GeoServer
  2. GEOS-317

Shapefile URLs with spaces or quotes

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.3.0-beta
    • Fix Version/s: 1.5.0-RC3
    • Component/s: Configuration
    • Labels:
      None
    • Environment:
      all
    • Number of attachments :
      0

      Description

      Adding a shapefile with a URL with a space in it could be a problem. I tried to use:
      file:c:\"Documents and Settings"\...

      But this will cause your .xml file to be invalid!!!

      It possible that just typing in a space will be okay, but
      1) we should add some documentation to the page to explain what to do
      (ie. they could possibily want to move the file to the GEOSERVER_HOME dir)
      2) we should give a few "for examples", including what to do for directories with
      spaces in them and how we want the "file:" portion to look like

        Activity

        Hide
        Paul Ramsey added a comment -

        I have seen this handed by URL-encoded the file name... perhaps that is a possibility?
        file://C:/Program%20Files/foo

        Show
        Paul Ramsey added a comment - I have seen this handed by URL-encoded the file name... perhaps that is a possibility? file://C:/Program%20Files/foo
        Hide
        dblasby added a comment -

        chris, you were talking about doing something along this lines...

        Show
        dblasby added a comment - chris, you were talking about doing something along this lines...
        Hide
        dblasby added a comment -

        set to RC3

        Show
        dblasby added a comment - set to RC3
        Hide
        Paolo Rizzi added a comment -

        We encounter a similar problem with our new MIFDataStore, because it has a parameter that contains a "m".
        You can configure it through the Web Admin interface, you can press "Apply", "Save" and "Load"
        and it all works well. But if you restart GeoServer or it's container, it gives an error because
        inside the catalog.xml file you'll have:
        <parameter value = "CoordSys Earth Projection 8, 87, "m", 9, 0, 0.9996, ... />

        It's not a real problem for us, because we're going to use it mainly outside of GeoServer
        (and we're anyway going to change or remove that parameter),
        but it's another case for this quotes problem.

        Show
        Paolo Rizzi added a comment - We encounter a similar problem with our new MIFDataStore, because it has a parameter that contains a "m". You can configure it through the Web Admin interface, you can press "Apply", "Save" and "Load" and it all works well. But if you restart GeoServer or it's container, it gives an error because inside the catalog.xml file you'll have: <parameter value = "CoordSys Earth Projection 8, 87, "m", 9, 0, 0.9996, ... /> It's not a real problem for us, because we're going to use it mainly outside of GeoServer (and we're anyway going to change or remove that parameter), but it's another case for this quotes problem.
        Hide
        Brent Owens added a comment -

        I can't reproduce any errors with the URL to the file location having a space in it, such as "C:/Documents and Settings/more path/filename.shp" but I can generate an error with a space in the file name. This will be fixed. The problem is that Geoserver will take the filename, minus the .shp extension, and use it as the FeatureType name. So if there is a space, right now it will just remove the space and concatinate the words together and throw an error when you try to access it:
        java.util.NoSuchElementException: Could not locate FeatureTypeConfig 'topp:namewithnospace'
        at org.vfny.geoserver.wms.requests.GetMapKvpReader.findLayer(GetMapKvpReader.java:1058)
        at org.vfny.geoserver.wms.requests.GetMapKvpReader.parseLayersParam(GetMapKvpReader.java:1033)
        at org.vfny.geoserver.wms.requests.GetMapKvpReader.parseLayersAndStyles(GetMapKvpReader.java:625)

        But if there is a space in the URL to the file name, Geoserver still finds the shapefile.

        Show
        Brent Owens added a comment - I can't reproduce any errors with the URL to the file location having a space in it, such as "C:/Documents and Settings/more path/filename.shp" but I can generate an error with a space in the file name. This will be fixed. The problem is that Geoserver will take the filename, minus the .shp extension, and use it as the FeatureType name. So if there is a space, right now it will just remove the space and concatinate the words together and throw an error when you try to access it: java.util.NoSuchElementException: Could not locate FeatureTypeConfig 'topp:namewithnospace' at org.vfny.geoserver.wms.requests.GetMapKvpReader.findLayer(GetMapKvpReader.java:1058) at org.vfny.geoserver.wms.requests.GetMapKvpReader.parseLayersParam(GetMapKvpReader.java:1033) at org.vfny.geoserver.wms.requests.GetMapKvpReader.parseLayersAndStyles(GetMapKvpReader.java:625) But if there is a space in the URL to the file name, Geoserver still finds the shapefile.
        Hide
        Brent Owens added a comment -

        I put in a temporary fix that will dissallow the user from entering a URL with any spaces in it. It uses javascript to handle this on the client side. I chose to do this right now as I didn't want to impact any XML readers/writers at this time. It may turn out that this solution is sufficient.

        Show
        Brent Owens added a comment - I put in a temporary fix that will dissallow the user from entering a URL with any spaces in it. It uses javascript to handle this on the client side. I chose to do this right now as I didn't want to impact any XML readers/writers at this time. It may turn out that this solution is sufficient.
        Hide
        dblasby added a comment -

        Probably should set this as fixed since the issues is still there.

        Show
        dblasby added a comment - Probably should set this as fixed since the issues is still there.
        Hide
        Chris Holmes added a comment -

        Changed to an unreleased version, since there's no way this is getting fixed in time a version already out.

        Show
        Chris Holmes added a comment - Changed to an unreleased version, since there's no way this is getting fixed in time a version already out.
        Hide
        Chris Holmes added a comment -

        I just tested this, had no problems, so closing it.

        Show
        Chris Holmes added a comment - I just tested this, had no problems, so closing it.

          People

          • Assignee:
            Chris Holmes
            Reporter:
            dblasby
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: