Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-1332

Escape spaces in URLs in URLDataSource

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Any

      Description

      At present the URLDataSource does not correctly escape spaces in URLs. This particularly affects usages where $

      {dataimporter.last_index_time}

      is present in the URL to support delta imports. That variable contains a space which should be escaped.

      1. SOLR-1332.patch
        3 kB
        Chris Eldredge

        Activity

        Hide
        chris.eldredge Chris Eldredge added a comment -

        Patch that escapes spaces.

        Show
        chris.eldredge Chris Eldredge added a comment - Patch that escapes spaces.
        Hide
        ehatcher Erik Hatcher added a comment -

        Just escaping spaces isn't good enough, though certainly a workable fix in simple cases. Each substitution into a URL would need to be escaped in some fashion to do this properly, right? Sounds tricky!

        Show
        ehatcher Erik Hatcher added a comment - Just escaping spaces isn't good enough, though certainly a workable fix in simple cases. Each substitution into a URL would need to be escaped in some fashion to do this properly, right? Sounds tricky!
        Hide
        noble.paul Noble Paul added a comment - - edited

        it is possible to escape strings using the in-built functions http://wiki.apache.org/solr/DataImportHandler#head-5675e913396a42eb7c6c5d3c894ada5dadbb62d7

        ${dataimporter.functions.encodeUrl(dataimporter_last_index_time)}
        
        Show
        noble.paul Noble Paul added a comment - - edited it is possible to escape strings using the in-built functions http://wiki.apache.org/solr/DataImportHandler#head-5675e913396a42eb7c6c5d3c894ada5dadbb62d7 ${dataimporter.functions.encodeUrl(dataimporter_last_index_time)}
        Hide
        chris.eldredge Chris Eldredge added a comment -

        We decided to only escape spaces to avoid breaking other test cases we could think of where a well formed query string in an invariant variable would get incorrectly double-escaped. The uncodeUrl function looks like what we need so we'll try that.

        Show
        chris.eldredge Chris Eldredge added a comment - We decided to only escape spaces to avoid breaking other test cases we could think of where a well formed query string in an invariant variable would get incorrectly double-escaped. The uncodeUrl function looks like what we need so we'll try that.
        Hide
        ehatcher Erik Hatcher added a comment -

        solution: use url encoder

        Show
        ehatcher Erik Hatcher added a comment - solution: use url encoder

          People

          • Assignee:
            Unassigned
            Reporter:
            chris.eldredge Chris Eldredge
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development