Merge remote-tracking branch 'origin/main' into feature/399

このコミットが含まれているのは:
2026-07-14 12:40:32 +09:00
コミット bc660676ef
9個のファイルの変更682行の追加4行の削除
+11 -2
ファイルの表示
@@ -57,9 +57,9 @@ class Post < ApplicationRecord
attribute :version_no, :integer, default: 1
before_validation :normalise_url
before_validation :normalise_url, if: :will_save_change_to_url?
validates :url, presence: true, uniqueness: true
validates :url, presence: true, uniqueness: true, length: { maximum: 768 }
validates :video_ms, numericality: { only_integer: true, greater_than: 0 }, allow_nil: true
validate :validate_original_created_range
@@ -174,5 +174,14 @@ class Post < ApplicationRecord
return if url.blank?
self.url = PostUrlNormaliser.normalise(url) || url.strip
u = URI.parse(url)
return unless u in URI::HTTP
u.host = u.host.downcase if u.host
u.path = u.path.sub(/\/\Z/, '') if u.path.present?
self.url = PostUrlSanitisationRule.sanitise(u.to_s)
rescue URI::InvalidURIError
;
end
end