diff options
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/activitypub/process_status_update_service.rb | 8 | ||||
-rw-r--r-- | app/services/delete_account_service.rb | 2 | ||||
-rw-r--r-- | app/services/verify_link_service.rb | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/app/services/activitypub/process_status_update_service.rb b/app/services/activitypub/process_status_update_service.rb index addd5fc27..a0605b1a3 100644 --- a/app/services/activitypub/process_status_update_service.rb +++ b/app/services/activitypub/process_status_update_service.rb @@ -92,7 +92,13 @@ class ActivityPub::ProcessStatusUpdateService < BaseService next if unsupported_media_type?(media_attachment_parser.file_content_type) || skip_download? - RedownloadMediaWorker.perform_async(media_attachment.id) if media_attachment.remote_url_previously_changed? || media_attachment.thumbnail_remote_url_previously_changed? + begin + media_attachment.download_file! if media_attachment.remote_url_previously_changed? + media_attachment.download_thumbnail! if media_attachment.thumbnail_remote_url_previously_changed? + media_attachment.save + rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError + RedownloadMediaWorker.perform_in(rand(30..600).seconds, media_attachment.id) + end rescue Addressable::URI::InvalidURIError => e Rails.logger.debug "Invalid URL in attachment: #{e}" end diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index a2d535d26..3a082c7c8 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -267,7 +267,7 @@ class DeleteAccountService < BaseService end def delete_actor_json - @delete_actor_json ||= Oj.dump(serialize_payload(@account, ActivityPub::DeleteActorSerializer, signer: @account, always_sign: true)) + @delete_actor_json ||= Oj.dump(serialize_payload(@account, ActivityPub::DeleteActorSerializer)) end def delivery_inboxes diff --git a/app/services/verify_link_service.rb b/app/services/verify_link_service.rb index 0a39d7f26..7496fe2d5 100644 --- a/app/services/verify_link_service.rb +++ b/app/services/verify_link_service.rb @@ -28,7 +28,7 @@ class VerifyLinkService < BaseService links = Nokogiri::HTML(@body).xpath('//a[contains(concat(" ", normalize-space(@rel), " "), " me ")]|//link[contains(concat(" ", normalize-space(@rel), " "), " me ")]') - if links.any? { |link| link['href'].downcase == @link_back.downcase } + if links.any? { |link| link['href']&.downcase == @link_back.downcase } true elsif links.empty? false @@ -38,6 +38,8 @@ class VerifyLinkService < BaseService end def link_redirects_back?(test_url) + return false if test_url.blank? + redirect_to_url = Request.new(:head, test_url, follow: false).perform do |res| res.headers['Location'] end |