Bug 60722 - URLEncoding error in combination with Spring DeferredResult and "%25" character in PathVariable
Summary: URLEncoding error in combination with Spring DeferredResult and "%25" charact...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.11
Hardware: PC Mac OS X 10.1
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-10 13:58 UTC by ango
Modified: 2017-02-16 09:51 UTC (History)
0 users



Attachments
local log of the error (17.74 KB, text/plain)
2017-02-10 14:03 UTC, ango
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ango 2017-02-10 13:58:29 UTC
reference reported bug at Spring:
https://jira.spring.io/browse/SPR-15242


URLEncoding error in combination with DeferredResult and "%25" character in PathVariable

There is a bug in combination with Percentage Encoding for the "%" character.
In combination with the DeferredResult and using @PathVariable.
For any other legal Percentage Encoding it works fine, except for the "%25", i.e. "%" character.
Here is the code snippet:
----
    @RequestMapping(value = "/test/{path_variable}", method = RequestMethod.GET)
    public DeferredResult<String> test(@PathVariable String path_variable) {
        DeferredResult<String> response = new DeferredResult<>();
 
        LOG.info("Request for {}", path_variable);
        
        try {
            response.setResult("Hello World");
        }
        catch (Error e) {
            LOG.debug("Error", e);
        }
        catch (Exception e) {
            LOG.debug("Exception", e);
        }
 
        return response;
    }
----
Comment 1 ango 2017-02-10 14:03:09 UTC
Created attachment 34745 [details]
local log of the error
Comment 2 Mark Thomas 2017-02-15 22:27:38 UTC
Thanks for the report. The root cause was dispatch() not taking account of the Context.dispatchersUseEncodedPaths setting.

Fixed in:
- trunk for 9.0.0.M18 onwards
- 8.5.x for 8.5.12 onwards
- 8.0.x for 8.0.42 onwards
- 7.0.x for 7.0.76 onwards
Comment 3 ango 2017-02-16 09:51:20 UTC
Thanks for the quick fix!