scotty-web / scotty

Haskell web framework inspired by Ruby's Sinatra, using WAI and Warp (Official Repository)
http://hackage.haskell.org/package/scotty
BSD 3-Clause "New" or "Revised" License
1.72k stars 134 forks source link

Fix handling of encoded slash in url path #302

Closed jfraudeau closed 8 months ago

jfraudeau commented 11 months ago

Currently url encoded forward slash is decoded before the routing logic is applied. This is a problem when we want to allow arbitrary user data to be passed as a path segment.

For example /test/some%2Fdata/path will be routed as /test/some/data/path it thus becomes impossible to have a forward slash in a captured path segment.

This fix bypasses the broken rountrip of intercalate "/" <-> split (=='/')

ocramz commented 11 months ago

@jfraudeau Thank you! Could you please add a test for this as well?

jfraudeau commented 11 months ago

@ocramz I added a test, let me know if anything else is missing or if there ara conventions I didn't follow

ocramz commented 11 months ago

Thank you @jfraudeau , it looks good but I'd like to merge it after #303 and make it use captureParam instead. What do you think?

jfraudeau commented 11 months ago

Yes no problem, do as you see fit

jfraudeau commented 9 months ago

Thank you @jfraudeau , it looks good but I'd like to merge it after #303 and make it use captureParam instead. What do you think?

Hi @ocramz I updated the pr to with upstream changes. Let me know if anything is still blocking