cancel
Showing results for 
Search instead for 
Did you mean: 

Slash in Input Path String is not handled in CAP?

spenceryang
Explorer
0 Kudos

Hi Colleagues,

I have a CAP service Entity MyService, primary keys are (id, displayed). It fails when I get as

localhost:8090/odata/v4/test/MyService(id=54642296-8b91-4145-a579-0e4d5a51cdb6,displayId='M-EUR/CNY-20210809')


The error message is 400: "The key value 'displayId' is invalid."

It might because of the slash in `displayId='M-EUR/CNY-20210809')` since it works without slash. So i replace / with %2F. But returns 400 from apache (not from cap service) Message Invalid URI: [The encoded slash character is not allowed].

I am wondering if in CAP there is an option to enable slash char handling?

Thanks!

gregorw
Active Contributor

Hi Spencer,

looks like a Bug. As you are an SAP Employee you might file an incident in the internal CAP repository.

Best Regards
Gregor

spenceryang
Explorer
0 Kudos

Hi gregorw Do you have a hint where I could send it? All documents I've seen direct me to ask questions in this community. I could not find elsewhere either...

Accepted Solutions (1)

Accepted Solutions (1)

marcbecker
Contributor

Slashes need to be encoded, if they should not be handled as a actual path separator., but as a character of a path segment. However Spring Boot and Tomcat reject encoded slashes in URLs by default due to security concerns. You need to explicitly configure Spring Boot and Tomcat to allow encoded slashes in URLs:

You can find some hints here how to configure this correctly: https://stackoverflow.com/questions/13482020/encoded-slash-2f-with-spring-requestmapping-path-param-.... If you are using Tomcat 10 (CAP Java 2.0) make sure you take a look at this answer: https://stackoverflow.com/a/76128441

Answers (0)