🚨Fix Rubocop lint errors
This commit is contained in:
@@ -3,8 +3,12 @@ class CreateExtensionForFile < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :attachments, :extension, :string, default: nil
|
||||
Attachment.find_each do |attachment|
|
||||
if attachment.external_url and attachment.file_type != fallback
|
||||
attachment.extension = Pathname.new(URI(attachment.external_url).path).extname rescue nil
|
||||
if attachment.external_url && (attachment.file_type != fallback)
|
||||
attachment.extension = begin
|
||||
Pathname.new(URI(attachment.external_url).path).extname
|
||||
rescue StandardError
|
||||
nil
|
||||
end
|
||||
attachment.save!
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user