Skip to content
Snippets Groups Projects
Unverified Commit ed046975 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Change User-Agent of link preview fetching service to include "Bot" (#14248)

This forces Twitter to render OpenGraph tags in the response
parent c7c07abe
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ class FetchLinkCardService < BaseService
def html
return @html if defined?(@html)
Request.new(:get, @url).add_headers('Accept' => 'text/html').perform do |res|
Request.new(:get, @url).add_headers('Accept' => 'text/html', 'User-Agent' => Mastodon::Version.user_agent + ' Bot').perform do |res|
if res.code == 200 && res.mime_type == 'text/html'
@html = res.body_with_limit
@html_charset = res.charset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment