fix: handle active storage preview error for password protected pdfs (#11888)
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
@@ -68,6 +68,22 @@ RSpec.describe Attachment do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'thumb_url' do
|
||||
it 'returns empty string for non-image attachments' do
|
||||
attachment = message.attachments.new(account_id: message.account_id, file_type: :file)
|
||||
attachment.file.attach(io: StringIO.new('fake pdf'), filename: 'test.pdf', content_type: 'application/pdf')
|
||||
|
||||
expect(attachment.thumb_url).to eq('')
|
||||
end
|
||||
|
||||
it 'generates thumb_url for image attachments' do
|
||||
attachment = message.attachments.create!(account_id: message.account_id, file_type: :image)
|
||||
attachment.file.attach(io: StringIO.new('fake image'), filename: 'test.jpg', content_type: 'image/jpeg')
|
||||
|
||||
expect(attachment.thumb_url).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
describe 'meta data handling' do
|
||||
let(:message) { create(:message) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user