Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Uploading package via link: pull file name from headers
  • Loading branch information
mkuron committed Sep 18, 2014
1 parent 5846f1b commit 2ad659b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/use_cases/process_package_upload.rb
Expand Up @@ -148,6 +148,7 @@ def retrieve_file_from_url(url)
open(url) do |u|
IO.copy_stream(u,file)
file_url_path = u.base_uri.path if u.respond_to?(:base_uri)
file_url_path = u.meta['content-disposition'].match(/filename=(\"?)(.+)\1/)[2] if u.respond_to?(:meta) and u.meta.has_key?('content-disposition') and u.meta['content-disposition'].include?('filename=')
file_url_path ||= URI.parse(url).path
package_file.original_filename = File.basename(file_url_path)
end
Expand Down

0 comments on commit 2ad659b

Please sign in to comment.