Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/paperdragon/file/operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ def process!(file, new_uid=nil, metadata={})
# Upload file, delete old file if there is one.
def upload!(job, old_uid, new_uid, metadata)
puts "........................STORE (process): #{uid}"
job.store(path: uid, :headers => {'x-amz-acl' => 'public-read', "Content-Type" => "image/jpeg"})
df_uid = job.store(path: uid, :headers => {'x-amz-acl' => 'public-read', "Content-Type" => "image/jpeg"})

# Dragonfly's filename disambiguation may change the uid
if df_uid != uid
uid = df_uid
metadata[:uid] = uid
end

if new_uid # new uid means delete old one.
puts "........................DELETE (reprocess): #{old_uid}"
Expand Down Expand Up @@ -72,4 +78,5 @@ def rename!(fingerprint, metadata={}) # fixme: we are currently ignoring the cus
end
end
end
end
end