Skip to content
Browse files

fix broken mime type lookup under Rack 0.5

  • Loading branch information...
1 parent a734cf3 commit 5c168fb85796a71e4ae0baa387ffec1031fee8d4 @rtomayko rtomayko committed
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/sinatra/base.rb
View
15 lib/sinatra/base.rb
@@ -3,12 +3,6 @@
require 'rack/builder'
require 'sinatra/rack/methodoverride'
-module Rack
- class File
- MIME_TYPES = Rack::Mime::MIME_TYPES unless defined? MIME_TYPES
- end
-end
-
module Sinatra
VERSION = '0.9.0'
@@ -756,3 +750,12 @@ def self.new(base=Base, options={}, &block)
base
end
end
+
+# Make Rack 0.5.0 backward compatibile with 0.4.0 mime types
+require 'rack/file'
+class Rack::File
+ unless defined? MIME_TYPES
+ MIME_TYPES = Hash.new {|hash,key|
+ Rack::Mime::MIME_TYPES[".#{key}"] }
+ end
+end

0 comments on commit 5c168fb

Please sign in to comment.
Something went wrong with that request. Please try again.