fix: handle active storage preview error for password protected pdfs (#11888)
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
@@ -17,7 +17,12 @@ class SlackUploadsController < ApplicationController
|
||||
end
|
||||
|
||||
def blob_url
|
||||
url_for(@blob.representation(resize_to_fill: [250, nil]))
|
||||
# Only generate representations for images
|
||||
if @blob.content_type.start_with?('image/')
|
||||
url_for(@blob.representation(resize_to_fill: [250, nil]))
|
||||
else
|
||||
url_for(@blob)
|
||||
end
|
||||
end
|
||||
|
||||
def avatar_url
|
||||
|
||||
@@ -60,11 +60,9 @@ class Attachment < ApplicationRecord
|
||||
end
|
||||
|
||||
def thumb_url
|
||||
if file.attached? && file.representable?
|
||||
url_for(file.representation(resize_to_fill: [250, nil]))
|
||||
else
|
||||
''
|
||||
end
|
||||
return '' unless file.attached? && image?
|
||||
|
||||
url_for(file.representation(resize_to_fill: [250, nil]))
|
||||
end
|
||||
|
||||
def with_attached_file?
|
||||
|
||||
Reference in New Issue
Block a user