Skip to content

Commit

Permalink
fix(data-export): File key uniqueness (#2821)
Browse files Browse the repository at this point in the history
## Context

Current key generation does not allow to re-run service if there's any
failure after file being attached because of unique constraint on active
storage blobs table

## Description

Add salt to key generation to satisfy uniqueness during repeated runs
  • Loading branch information
floganz authored Nov 18, 2024
1 parent 5abc45b commit 6b03422
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/services/data_exports/combine_parts_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def call
data_export.file.attach(
io: tempfile,
filename: data_export.filename,
key: "data_exports/#{data_export.id}.#{data_export.format}",
key: "data_exports/#{data_export.id}-#{SecureRandom.hex(5)}.#{data_export.format}",
content_type: "text/csv"
)
end
Expand Down

0 comments on commit 6b03422

Please sign in to comment.