lib/capcode/render/static.rb in capcode-render-static-0.3.0 vs lib/capcode/render/static.rb in capcode-render-static-0.4.0
- old
+ new
@@ -1,7 +1,8 @@
require 'rubygems'
require 'mime/types'
+require 'uri'
module Capcode
module Helpers
def render_static( f, opts = {} ) #:nodoc:
# Update options
@@ -15,10 +16,10 @@
# Update Content-Type
if opts.keys.include?(:content_type)
@response['Content-Type'] = opts[:content_type]
else
- @response['Content-Type'] = MIME::Types.type_for(File.join( static[:path], f ))[0].content_type
+ @response['Content-Type'] = MIME::Types.type_for(File.join( static[:path], URI.parse( f ).path ))[0].content_type
end
if !opts.keys.include?(:exact_path) or opts[:exact_path] == true
redirect File.join( static[:uri], f )
else
\ No newline at end of file