このコミットが含まれているのは:
2026-07-16 23:12:14 +09:00
コミット 3f75994bd4
14個のファイルの変更592行の追加404行の削除
+6 -1
ファイルの表示
@@ -11,7 +11,12 @@ class PostImportsController < ApplicationController
def validate
rows = normalised_import_rows allow_warning_fields: true
changed_row = Integer(params[:changed_row], exception: false)
changed_row =
if params[:changed_row].to_s == 'all'
true
else
Integer(params[:changed_row], exception: false)
end
result =
PostImportPreviewer.new.preview_rows(rows:,
fetch_metadata: changed_row,
+21
ファイルの表示
@@ -38,6 +38,27 @@ class PreviewController < ApplicationController
render_unprocessable_entity(e.message)
end
def image
return render_bad_request('URL は必須です.') if params[:url].blank?
attachment = Post.resized_thumbnail_attachment(
StringIO.new(Preview::ThumbnailFetcher.fetch_image_response(params[:url]).body))
attachment[:io].rewind
send_data attachment[:io].read,
type: attachment[:content_type],
disposition: 'inline'
rescue Preview::UrlSafety::UnsafeUrl => e
render_bad_request(e.message)
rescue Preview::HttpFetcher::FetchTimeout => e
render_preview_error(e.message, :gateway_timeout)
rescue Preview::HttpFetcher::ResponseTooLarge => e
render_preview_error(e.message, :payload_too_large)
rescue Preview::HttpFetcher::FetchFailed => e
render_preview_error(e.message, :bad_gateway)
rescue Preview::ThumbnailFetcher::GenerationFailed, MiniMagick::Error => e
render_unprocessable_entity(e.message)
end
private
def require_member!
+1
ファイルの表示
@@ -31,6 +31,7 @@ Rails.application.routes.draw do
scope :preview, controller: :preview do
get :title
get :thumbnail
get :image
end
scope 'posts/import', controller: :post_imports do