Browse Source

preview card 兼容有重复content-type头的情况

pull/4/head
欧醚 4 years ago
parent
commit
bd9607f5c6
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      app/services/fetch_link_card_service.rb

+ 1
- 0
app/services/fetch_link_card_service.rb View File

@ -46,6 +46,7 @@ class FetchLinkCardService < BaseService
return @html if defined?(@html)
Request.new(:get, @url).add_headers('Accept' => 'text/html', 'User-Agent' => Mastodon::Version.user_agent + ' Bot').perform do |res|
res.headers['Content-Type'] = res.headers['Content-Type'][0] if res.headers['Content-Type'].kind_of?(Array)
if res.code == 200 && res.mime_type == 'text/html'
@html = res.body_with_limit
@html_charset = res.charset

Loading…
Cancel
Save