Sha256: e7c8c1ac3d08ceefcc8b08b24161cd1501f4e002d33700ec8fd3d7579af13dad

Contents?: true

Size: 416 Bytes

Versions: 6

Compression:

Stored size: 416 Bytes

Contents

module Capcode
  module Helpers
    def render_static( f, opts = { :exact_path => true } ) #:nodoc:
      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

6 entries across 6 versions & 1 rubygems

Version Path
Capcode-0.8.9 lib/capcode/render/static.rb
Capcode-0.8.8 lib/capcode/render/static.rb
Capcode-0.8.7 lib/capcode/render/static.rb
Capcode-0.8.6 lib/capcode/render/static.rb
Capcode-0.8.5 lib/capcode/render/static.rb
Capcode-0.8.4 lib/capcode/render/static.rb