Skip to content

Commit

Permalink
Use URI.join to assemble the URL to fetch a single post
Browse files Browse the repository at this point in the history
That normalizes any extra / on the base URL.
  • Loading branch information
jhass committed Dec 9, 2014
1 parent ed0005c commit 6d682d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/diaspora/fetcher/single.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def find_or_fetch_from_remote guid, author_id
# @param [String] guid the remote post's guid
# @return [Post] an unsaved remote post or false if the post was not found
def fetch_post author, guid
url = author.url + "/p/#{guid}.xml"
url = URI.join(author.url, "/p/#{guid}.xml")
response = Faraday.get(url)
raise Diaspora::PostNotFetchable if response.status == 404 # Old pod, Friendika, deleted
raise "Failed to get #{url}" unless response.success? # Other error, N/A for example
Expand Down

0 comments on commit 6d682d6

Please sign in to comment.