Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21197

URISupport.parseQuery is not decoding correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 4.7.0
    • None
    • camel-core
    • None
    • Unknown

    Description

      Hi team,

      while using URISupport.parseQuery the given query was not correctly decoded:

      Sample JUnit test (org.apache.camel.util.URISupportTest):
       

      @Test
      public void testParseQueryDFi() throws Exception {
          Map<String, Object> map = URISupport.parseQuery("Camel-Saga-Complete=direct%3A%2F%2Fsaga1_sagaService_complete");
          assertEquals(1, map.size());
          assertEquals("direct://saga1_sagaService_complete", map.get("Camel-Saga-Complete"));
      } 

      If i handover the query 'Camel-Saga-Complete=direct%3A%2F%2Fsaga1_sagaService_complete'
      i expect the decoded value
      for 'Camel-Saga-Complete' as 'direct://saga1_sagaService_complete'.

      I am wrong? Did i understand the utility class wrong?

      Within the code i can see, that the string was adjusted to replace '%', this is
      causing the issue:

      URIScanner.addParameter:

       

      if (isRaw) {
          text = value.toString();
      } else {
          // need to replace % with %25 to avoid losing "%" when decoding
          final String s = replacePercent(value.toString());    
          text = URLDecoder.decode(s, CHARSET);
      }

       

      best regards
      Dirk

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dfiedler Dirk Fiedler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: