このコミットが含まれているのは:
2026-07-16 18:33:45 +09:00
コミット ef95b20a7e
9個のファイルの変更145行の追加24行の削除
+2 -13
ファイルの表示
@@ -158,10 +158,8 @@ class Post < ApplicationRecord
def attach_thumbnail_from_url! raw_url
response = Preview::ThumbnailFetcher.fetch_image_response(raw_url)
thumbnail.attach(
io: StringIO.new(response.body),
filename: remote_thumbnail_filename(response.url),
content_type: response.content_type)
resized_thumbnail!
self.class.resized_thumbnail_attachment(
StringIO.new(response.body)))
rescue Preview::UrlSafety::UnsafeUrl,
Preview::ThumbnailFetcher::GenerationFailed,
Preview::HttpFetcher::FetchFailed,
@@ -173,15 +171,6 @@ class Post < ApplicationRecord
private
def remote_thumbnail_filename url
filename = File.basename(URI.parse(url).path.to_s)
return filename if filename.present? && filename != '/'
'thumbnail'
rescue URI::InvalidURIError
'thumbnail'
end
def validate_original_created_range
f = parse_original_created_value(:original_created_from)
b = parse_original_created_value(:original_created_before)