parent
ea6577af6d
commit
313b2da703
2 changed files with 5 additions and 1 deletions
|
@ -50,7 +50,7 @@ class Messages::Facebook::MessageBuilder
|
|||
|
||||
def attach_file(attachment, file_url)
|
||||
file_resource = LocalResource.new(file_url)
|
||||
attachment.file.attach(io: file_resource.file, filename: file_resource.tmp_filename, content_type: file_resource.encoding)
|
||||
attachment.file.attach(io: file_resource.file, filename: file_resource.filename, content_type: file_resource.encoding)
|
||||
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError => e
|
||||
Rails.logger.info "invalid url #{file_url} : #{e.message}"
|
||||
end
|
||||
|
|
|
@ -35,4 +35,8 @@ class LocalResource
|
|||
def tmp_folder
|
||||
Rails.root.join('tmp')
|
||||
end
|
||||
|
||||
def filename
|
||||
File.basename(uri.path)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue