Skip to content

Commit 6d1e049

Browse files
committed
only reattach files if path or storage key have changed
1 parent 09aaff6 commit 6d1e049

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/models/model_file.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ def mesh
178178
memoize :mesh
179179

180180
def reattach!
181-
attachment_attacher.attach attachment, storage: model.library.storage_key
182-
save!
181+
if attachment.id != path_within_library || attachment.storage_key != model.library.storage_key
182+
attachment_attacher.attach attachment, storage: model.library.storage_key
183+
save!
184+
end
183185
end
184186

185187
def convert_to!(format)

0 commit comments

Comments
 (0)