diff --git a/app/controllers/preview_document_page_controller.rb b/app/controllers/preview_document_page_controller.rb index 271d6169..5bf42138 100644 --- a/app/controllers/preview_document_page_controller.rb +++ b/app/controllers/preview_document_page_controller.rb @@ -12,7 +12,8 @@ class PreviewDocumentPageController < ActionController::API return head :not_found unless attachment - preview_image = attachment.preview_images.joins(:blob).find_by(blob: { filename: "#{params[:id]}#{FORMAT}" }) + preview_image = attachment.preview_images.joins(:blob) + .find_by(blob: { filename: ["#{params[:id]}.png", "#{params[:id]}.jpg"] }) return redirect_to preview_image.url, allow_other_host: true if preview_image