Browse Source

Guard against nil URLs in Request class (#7284)

Fix #7265
pull/4/head
Eugen Rochko 6 years ago
committed by GitHub
parent
commit
965345316f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions
  1. +3
    -0
      app/lib/request.rb
  2. +2
    -0
      app/services/activitypub/fetch_featured_collection_service.rb

+ 3
- 0
app/lib/request.rb View File

@ -9,12 +9,15 @@ class Request
include RoutingHelper include RoutingHelper
def initialize(verb, url, **options) def initialize(verb, url, **options)
raise ArgumentError if url.blank?
@verb = verb @verb = verb
@url = Addressable::URI.parse(url).normalize @url = Addressable::URI.parse(url).normalize
@options = options.merge(use_proxy? ? Rails.configuration.x.http_client_proxy : { socket_class: Socket }) @options = options.merge(use_proxy? ? Rails.configuration.x.http_client_proxy : { socket_class: Socket })
@headers = {} @headers = {}
raise Mastodon::HostValidationError, 'Instance does not support hidden service connections' if block_hidden_service? raise Mastodon::HostValidationError, 'Instance does not support hidden service connections' if block_hidden_service?
set_common_headers! set_common_headers!
set_digest! if options.key?(:body) set_digest! if options.key?(:body)
end end

+ 2
- 0
app/services/activitypub/fetch_featured_collection_service.rb View File

@ -4,6 +4,8 @@ class ActivityPub::FetchFeaturedCollectionService < BaseService
include JsonLdHelper include JsonLdHelper
def call(account) def call(account)
return if account.featured_collection_url.blank?
@account = account @account = account
@json = fetch_resource(@account.featured_collection_url, true) @json = fetch_resource(@account.featured_collection_url, true)

Loading…
Cancel
Save