Chatwoot/spec/support/file_upload_helpers.rb
jacsonsantospht af020f446e
fix: check the content type for the file when uploading from cloud storage (#5378)
When sending the message with audio, only the signed id of the file is sent.
In the back end check only the UploadedFile type.
The attachment has the default file type image, now it gets the content type from the signed id

Fixes: #5375

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2022-10-21 18:05:36 -07:00

9 lines
242 B
Ruby

module FileUploadHelpers
def get_blob_for(file_path, content_type)
ActiveStorage::Blob.create_and_upload!(
io: File.open(file_path, 'rb'),
filename: File.basename(file_path),
content_type: content_type
)
end
end