このコミットが含まれているのは:
2026-07-17 23:14:37 +09:00
コミット 0ae41b6266
19個のファイルの変更455行の追加216行の削除
+14 -18
ファイルの表示
@@ -55,14 +55,21 @@ class PostBulkCreator
errors: e.record.errors.to_hash,
base_errors: e.record.errors[:base] }
rescue ActiveRecord::RecordNotUnique => e
raise unless e.message.include?('index_posts_on_url')
existing_post = existing_post_for_race(attributes)
raise if existing_post.nil?
if e.message.include?('index_posts_on_url')
existing_post = existing_post_for_race(attributes)
return {
status: 'skipped',
existing_post: existing_post } if existing_post.present?
end
Rails.logger.error(
"post_bulk_creator_record_not_unique #{ { error: e.class.name,
message: e.message }.to_json }")
{
status: 'skipped',
existing_post: existing_post }
status: 'failed',
recoverable: false,
errors: { base: ['登録中にエラーが発生しました.'] },
base_errors: [] }
rescue Tag::NicoTagNormalisationError
{
status: 'failed',
@@ -134,17 +141,6 @@ class PostBulkCreator
end
def compact_existing_post post
return nil if post.nil?
{
id: post.id,
title: post.title,
url: post.url,
thumbnail_url:
if post.thumbnail.attached?
Rails.application.routes.url_helpers.rails_storage_proxy_url(
post.thumbnail,
only_path: false)
end }
PostCompactRepr.base(post)
end
end
+1 -12
ファイルの表示
@@ -88,17 +88,6 @@ class PostCreatePreflight
return nil if post_id.blank?
post = Post.with_attached_thumbnail.find_by(id: post_id)
return nil if post.nil?
{
id: post.id,
title: post.title,
url: post.url,
thumbnail_url:
if post.thumbnail.attached?
Rails.application.routes.url_helpers.rails_storage_proxy_url(
post.thumbnail,
only_path: false)
end }
PostCompactRepr.base(post)
end
end
+9 -1
ファイルの表示
@@ -255,7 +255,15 @@ class PostImportPreviewer
def sanitise_metadata_url value
return nil unless value.is_a?(String)
PostUrlNormaliser.normalise(value)
stripped = value.strip
return nil if stripped.blank?
uri = URI.parse(stripped)
return nil unless uri.is_a?(URI::HTTP) && uri.host.present?
stripped
rescue URI::InvalidURIError
nil
end
def sanitise_metadata_time value