Ruby on Rails
2
Вклад в тег
[2012-07-30 10:46:52] ERROR Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT
/Users/dmsilaev/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.7/lib/action_dispatch/middleware/static.rb:14:in `join'
def match?(path)
path = path.dup
full_path = path.empty? ? @root : File.join(@root, escape_glob_chars(unescape_path(path))) #14 line
paths = "#{full_path}#{ext}"
matches = Dir[paths]
match = matches.detect { |m| File.file?(m) }
if match
match.sub!(@compiled_root, '')
::Rack::Utils.escape(match)
end
end
def escape_glob_chars(path)
path.force_encoding('binary') if path.respond_to? :force_encoding
path.gsub(/[*?{}\[\]]/, "\\\\\\&")
end