Fix: 投稿ではないリンクを参照したときにリンクプレビューが生成されない問題 (#482)

This commit is contained in:
KMY(雪あすか) 2024-01-18 13:09:20 +09:00 committed by GitHub
parent 6aede85a2d
commit 46161e5348
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 5 deletions

View file

@ -88,6 +88,10 @@ class FetchLinkCardService < BaseService
end
def referenced_urls
referenced_urls_raw.filter { |uri| ActivityPub::TagManager.instance.uri_to_resource(uri, Status, url: true).present? }
end
def referenced_urls_raw
unless @status.local?
document = Nokogiri::HTML(@status.text)
document.search('a[href^="http://"]', 'a[href^="https://"]').each do |link|