joshbuddy / http_router

A kick-ass HTTP router for use in Rack
MIT License
198 stars 44 forks source link

(.:format) parsing ignoring multiple periods in last parameter #23

Open adamlwatson opened 12 years ago

adamlwatson commented 12 years ago

Hi Josh,

I am working with http_router within a Goliath 0.9.4 project. I have a route with a variable path segment at the end, of which the value can contain multiple periods. If I add in the (.:format) specifier, then everything following the first period in the value of this path segment is truncated.

For example, if I specify my route as such:

get '/foo/:bar(.:format)'

...and the incoming request looks like this:

http://localhost/foo/baz.bat.json

...then the resulting value I receive for the :bar parameter is just "baz" instead of "baz.bat".

Is there any workaround for this? I'm thinking that the (.:format) specifier should not be parsing out everything following the first period... it should be looking for the last period in the parameter value.

Thanks, Adam