Fixed duplicating URL of photo type of oEmbed (#5763)

lolsob-rspec
abcang 2017-11-21 04:45:54 +09:00 committed by Eugen Rochko
parent ef14321fff
commit 4e409e629d
1 changed files with 3 additions and 0 deletions

View File

@ -74,6 +74,9 @@ class FetchLinkCardService < BaseService
return false unless response.respond_to?(:type)
# The photo will change the URL. So, to avoid duplication of URLs, PreviewCard needs to be checked again.
@card = PreviewCard.find_by(url: response.url) || @card if response.type == 'photo'
@card.type = response.type
@card.title = response.respond_to?(:title) ? response.title : ''
@card.author_name = response.respond_to?(:author_name) ? response.author_name : ''