Merge commit 'fd284311e7
' into kb_migration
This commit is contained in:
commit
287eacf5f3
400 changed files with 4667 additions and 5387 deletions
|
@ -45,20 +45,18 @@ class FetchLinkCardService < BaseService
|
|||
def html
|
||||
return @html if defined?(@html)
|
||||
|
||||
Request.new(:get, @url).add_headers('Accept' => 'text/html', 'User-Agent' => "#{Mastodon::Version.user_agent} Bot").perform do |res|
|
||||
@html = Request.new(:get, @url).add_headers('Accept' => 'text/html', 'User-Agent' => "#{Mastodon::Version.user_agent} Bot").perform do |res|
|
||||
next unless res.code == 200 && res.mime_type == 'text/html'
|
||||
|
||||
# We follow redirects, and ideally we want to save the preview card for
|
||||
# the destination URL and not any link shortener in-between, so here
|
||||
# we set the URL to the one of the last response in the redirect chain
|
||||
@url = res.request.uri.to_s
|
||||
@card = PreviewCard.find_or_initialize_by(url: @url) if @card.url != @url
|
||||
|
||||
if res.code == 200 && res.mime_type == 'text/html'
|
||||
@html_charset = res.charset
|
||||
@html = res.body_with_limit
|
||||
else
|
||||
@html_charset = nil
|
||||
@html = nil
|
||||
end
|
||||
@html_charset = res.charset
|
||||
|
||||
res.body_with_limit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class SuspendAccountService < BaseService
|
|||
rescue Aws::S3::Errors::NotImplemented => e
|
||||
Rails.logger.error "Error trying to change ACL on #{attachment.s3_object(style).key}: #{e.message}"
|
||||
end
|
||||
when :fog
|
||||
when :fog, :azure
|
||||
# Not supported
|
||||
when :filesystem
|
||||
begin
|
||||
|
|
|
@ -81,7 +81,7 @@ class UnsuspendAccountService < BaseService
|
|||
rescue Aws::S3::Errors::NotImplemented => e
|
||||
Rails.logger.error "Error trying to change ACL on #{attachment.s3_object(style).key}: #{e.message}"
|
||||
end
|
||||
when :fog
|
||||
when :fog, :azure
|
||||
# Not supported
|
||||
when :filesystem
|
||||
begin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue