Reputation: 121
I have a Sinatra route like
get 'check/:input' do |in|
##Do stuff in here
end
but when I put a string in :input that contains a forward slash, such as "abcde/12345" or even encoded like "abcde%2F12345", Sinatra is thinking I am trying to reach
check/abcde/12345
and I hit the standard Sinatra 404 page. How do I get around this? I need the slash in the input variable, so I can't simply trim it out or anything like that. Any help would be greatly appreciated!!
Upvotes: 2
Views: 579
Reputation: 79733
This is done deliberately as part of rack-protection
’s path traversal protection.
To disable it you can do
set :protection, :except => :path_traversal
Upvotes: 1
Reputation: 1401
This is probably what you are looking for. Props to the person who answered it here: https://stackoverflow.com/a/529172/78551
Basically you are confusing the router. You need to pull it in as separate inputs and join them back in the action.
Upvotes: 0