Sha256: 9d3a2c883c294af8456cb1cffd22c7b42ca712a9a4e5b2b97eeb03864f627019
Contents?: true
Size: 707 Bytes
Versions: 1
Compression:
Stored size: 707 Bytes
Contents
module Capcode module Helpers def render_static( f, opts = {} ) #:nodoc: # Update options opts = { :exact_path => true }.merge(opts) opts = (Capcode.options[:static] || {}).merge(opts) # Update Content-Type @response['Content-Type'] = opts[:content_type] if opts.keys.include?(:content_type) # Path with ".." not allowed if Capcode.static.nil? or f.include? '..' return [403, {}, '403 - Invalid path'] end if !opts.keys.include?(:exact_path) or opts[:exact_path] == true redirect File.join( static[:uri], f ) else File.read( File.join( static[:path], f ) ).to_s end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capcode-render-static-0.1.0 | lib/capcode/render/static.rb |