Permalink
Browse files

Rack::Locale: a qvalue can be "0" or "1"

  • Loading branch information...
1 parent 4ccf9f0 commit 61a04714c0629df6b99f7c3ff5f279fd9e18e2e6 James A. Rosen committed Aug 19, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/rack/contrib/locale.rb
View
2 lib/rack/contrib/locale.rb
@@ -13,7 +13,7 @@ def call(env)
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
if lang = env["HTTP_ACCEPT_LANGUAGE"]
lang = lang.split(",").map { |l|
- l += ';q=1.0' unless l =~ /;q=\d+\.\d+$/
+ l += ';q=1.0' unless l =~ /;q=\d+(?:\.\d+)?$/
l.split(';q=')
}.sort_by { |(locale, qvalue)|
qvalue.to_f

0 comments on commit 61a0471

Please sign in to comment.