Escape language codes before matching them in case they contain
characters with special meaning in a regexp. Closes #2318.
This commit is contained in:
parent
088bd1dcb2
commit
f0d3831f12
1 changed files with 1 additions and 1 deletions
|
@ -49,7 +49,7 @@ module HttpAcceptLanguage
|
||||||
def compatible_language_from(array)
|
def compatible_language_from(array)
|
||||||
user_preferred_languages.map do |x|
|
user_preferred_languages.map do |x|
|
||||||
array.find do |y|
|
array.find do |y|
|
||||||
y.to_s =~ /^#{x.to_s}(-|$)/
|
y.to_s =~ /^#{Regexp.escape(x.to_s)}(-|$)/
|
||||||
end
|
end
|
||||||
end.compact.first
|
end.compact.first
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue