diff --git a/app/models/filedrop_file.rb b/app/models/filedrop_file.rb index 235a5b14589009f47cb49679fc09a675a83cd85b..5000ae25bee64c1ee2f7357648ae4a1a95add0f5 100644 --- a/app/models/filedrop_file.rb +++ b/app/models/filedrop_file.rb @@ -17,7 +17,11 @@ class FiledropFile < ApplicationRecord end def download(url) - # TBD: only download if orig_created is newer than actual file change time + if File.exist?(local_path) + local_sha1 = Digest::SHA1.file(local_path).hexdigest + return if local_sha1 == checksum + end + response = HTTParty.get(url) if response.success? File.open(local_path, 'wb') do |file|