Skip to content

Commit

Permalink
Fix Rack bug rack/rack#301
Browse files Browse the repository at this point in the history
  • Loading branch information
alexch committed Jan 7, 2012
1 parent d4f4e36 commit 20f43a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'rack/codehighlighter'
require 'coderay'

# Fix Rack bug https://github.com/rack/rack/issues/301
require './lib/rack_static_patch'

use Rack::ShowExceptions
use Rack::ShowStatus
use Rack::Static, :urls => ["/css", "/img"], :root => "public"
Expand Down
13 changes: 13 additions & 0 deletions lib/rack_static_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Fix Rack bug https://github.com/rack/rack/issues/301
module Rack
class Static
def initialize(app, options={})
@app = app
@urls = options[:urls] || ["/favicon.ico"]
@index = options[:index]
root = options[:root] || Dir.pwd
cache_control = options[:cache_control]
@file_server = Rack::File.new(root, cache_control)
end
end
end

0 comments on commit 20f43a8

Please sign in to comment.