From 192746ec3ed59e3cc647136338c78dd18a11316a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 2 May 2018 15:44:22 +0200 Subject: [PATCH] Guard against nil URLs in Request class (#7284) Fix #7265 --- app/lib/request.rb | 3 +++ app/services/activitypub/fetch_featured_collection_service.rb | 2 ++ 2 files changed, 5 insertions(+) diff --git a/app/lib/request.rb b/app/lib/request.rb index 0acd654da0..00f94dacf5 100644 --- a/app/lib/request.rb +++ b/app/lib/request.rb @@ -9,12 +9,15 @@ class Request include RoutingHelper def initialize(verb, url, **options) + raise ArgumentError if url.blank? + @verb = verb @url = Addressable::URI.parse(url).normalize @options = options.merge(use_proxy? ? Rails.configuration.x.http_client_proxy : { socket_class: Socket }) @headers = {} raise Mastodon::HostValidationError, 'Instance does not support hidden service connections' if block_hidden_service? + set_common_headers! set_digest! if options.key?(:body) end diff --git a/app/services/activitypub/fetch_featured_collection_service.rb b/app/services/activitypub/fetch_featured_collection_service.rb index 40714e9801..6a137b520b 100644 --- a/app/services/activitypub/fetch_featured_collection_service.rb +++ b/app/services/activitypub/fetch_featured_collection_service.rb @@ -4,6 +4,8 @@ class ActivityPub::FetchFeaturedCollectionService < BaseService include JsonLdHelper def call(account) + return if account.featured_collection_url.blank? + @account = account @json = fetch_resource(@account.featured_collection_url, true)