Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

#finger should correctly handle %40 in acct uri #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/goldfinger/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def url
end

def standard_url
"#{@scheme}://#{domain}/.well-known/webfinger?resource=#{@uri}"
"#{@scheme}://#{domain}/.well-known/webfinger?resource=#{CGI.escape @uri}"
end

def url_from_template(template)
Expand Down
13 changes: 13 additions & 0 deletions spec/goldfinger/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,17 @@
end
end
end

describe '#finger' do
before do
stub_request(:get, 'https://ab.com/.well-known/webfinger?resource=acct:someone%[email protected]').to_return(status: 404)
stub_request(:get, 'https://ab.com/.well-known/webfinger?resource=acct:someone%[email protected]').to_return(body: fixture('quitter.no_.well-known_webfinger.json'), headers: { content_type: 'application/jrd+json' })
end

subject { Goldfinger::Client.new('acct:someone%[email protected]') }

it 'should correctly handle %40 in acct uri' do
expect(subject.finger).to be_instance_of Goldfinger::Result
end
end
end