Module: SaferSendFile::Streaming

Defined in:
lib/safer_send_file/streaming.rb

Instance Method Summary collapse

Instance Method Details

#safer_send_file(path, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/safer_send_file/streaming.rb', line 3

def safer_send_file(path, options = {})
  full_path = File.expand_path(path)
  if SaferSendFile.allowed_directories.any? { |dir| dir == full_path[0..dir.size-1] }
    send_file full_path, options
  else
    raise SaferSendFile::NotAllowed
  end
end