On Fri, 2010-05-21 at 12:46 +0200, mfojtik@redhat.com wrote:
server/lib/sinatra/respond_to.rb | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/server/lib/sinatra/respond_to.rb b/server/lib/sinatra/respond_to.rb index c097e8e..bafcff7 100644 --- a/server/lib/sinatra/respond_to.rb +++ b/server/lib/sinatra/respond_to.rb @@ -45,19 +45,24 @@ module Sinatra next if self.class.development? && request.path_info =~ %r{/__sinatra__/.*?.png}
unless options.static? && options.public? && (request.get? || request.head?) && static_file?(request.path_info)
request.path_info.sub! %r{\.([^\./]+)$}, ''
ext = nil
if request.xhr? && options.assume_xhr_is_js?
ext = :js
elsif ! $1.nil?
ext = $1
elsif env['HTTP_ACCEPT'].nil? || env['HTTP_ACCEPT'].empty?
ext = options.default_content
end
if ext
@mime_types = [ Helpers::mime_type(ext) ]
format ext
rpi = request.path_info.sub(%r{\.([^\./]+)$}, '')
if (not $1) or ($1 and TEXT_MIME_TYPES.include?($1.to_sym))
It doesn't seem to cause trouble, but shouldn't the above check against Rack::Mime::MIME_TYPES, i.e. the list of all known extensions for mime types, not just the text ones ?
David