Module: Down::Utils
- Defined in:
- lib/down/utils.rb
Class Method Summary collapse
Class Method Details
.filename_from_content_disposition(content_disposition) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/down/utils.rb', line 7 def filename_from_content_disposition(content_disposition) content_disposition = content_disposition.to_s filename = content_disposition[/filename="([^"]*)"/, 1] || content_disposition[/filename=(.+)/, 1] filename = CGI.unescape(filename.to_s.strip) filename unless filename.empty? end |
.filename_from_path(path) ⇒ Object
16 17 18 19 |
# File 'lib/down/utils.rb', line 16 def filename_from_path(path) filename = path.split("/").last CGI.unescape(filename) if filename end |