fix: Email attachments created with empty filename (#10420)
- We observed in prod for certain emails active storage blob objects were getting created with empty file name. The conversations further causes conversation and filter pages to break. This change will fix the mentioned issue. fixes: https://linear.app/chatwoot/issue/CW-3331/missing-file-name-for-some-of-the-uploads-for-emails --------- Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
@@ -77,7 +77,7 @@ class MailPresenter < SimpleDelegator
|
||||
mail.attachments.map do |attachment|
|
||||
blob = ActiveStorage::Blob.create_and_upload!(
|
||||
io: StringIO.new(attachment.body.to_s),
|
||||
filename: attachment.filename,
|
||||
filename: attachment.filename.presence || "attachment_#{SecureRandom.hex(4)}",
|
||||
content_type: attachment.content_type
|
||||
)
|
||||
{ original: attachment, blob: blob }
|
||||
|
||||
Reference in New Issue
Block a user