class Pannier::FileHandler
Public Class Methods
new(allowed, *args)
click to toggle source
Calls superclass method
# File lib/pannier/file_handler.rb, line 4 def initialize(allowed, *args) @allowed = allowed super(*args) end
Public Instance Methods
call(env)
click to toggle source
Calls superclass method
# File lib/pannier/file_handler.rb, line 9 def call(env) return fail(404, 'File not a member of this package') unless handle?(env) super(env) end
handle?(env)
click to toggle source
# File lib/pannier/file_handler.rb, line 14 def handle?(env) path = Rack::Utils.unescape(env['PATH_INFO']) @allowed.include?(File.join(@root, path)) end