diff --git a/lib/middleman/base.rb b/lib/middleman/base.rb index 9f7dc422..89f74a7e 100644 --- a/lib/middleman/base.rb +++ b/lib/middleman/base.rb @@ -36,7 +36,7 @@ module Middleman # Rack helper for adding mime-types during local preview def self.mime(ext, type) ext = ".#{ext}" unless ext.to_s[0] == ?. - Rack::Mime::MIME_TYPES[ext.to_s] = type + ::Rack::Mime::MIME_TYPES[ext.to_s] = type end # Convenience function to discover if a tempalte exists for the requested renderer (haml, sass, etc) diff --git a/lib/middleman/rack/static.rb b/lib/middleman/rack/static.rb index 6357b899..69d967a4 100644 --- a/lib/middleman/rack/static.rb +++ b/lib/middleman/rack/static.rb @@ -9,7 +9,8 @@ module Middleman def call(env) path = env["PATH_INFO"] - if path.include?("favicon.ico") || File.exists?(File.join(Middleman::Base.public, path)) + file_path = File.join(Middleman::Base.public, path) + if path.include?("favicon.ico") || (File.exists?(file_path) && !File.directory?(file_path)) @file_server.call(env) else @app.call(env)