diff --git a/lib/webfinger_profile.rb b/lib/webfinger_profile.rb index f5ff75da1..867a506c1 100644 --- a/lib/webfinger_profile.rb +++ b/lib/webfinger_profile.rb @@ -17,6 +17,7 @@ class WebfingerProfile def set_fields doc = Nokogiri::XML.parse(webfinger_profile) + doc.remove_namespaces! account_string = doc.css('Subject').text.gsub('acct:', '').strip @@ -36,13 +37,11 @@ class WebfingerProfile end end - if doc.at('Link[rel=diaspora-public-key]') - begin - pubkey = text_of_attribute( doc.at('Link[rel=diaspora-public-key]'), 'href') - @public_key = Base64.decode64 pubkey - rescue => e - Rails.logger.info("event => :invalid_profile, :identifier => #{@account}") - end + begin + pubkey = text_of_attribute( doc.at('Link[rel=diaspora-public-key]'), 'href') + @public_key = Base64.decode64 pubkey + rescue => e + Rails.logger.info("event => :invalid_profile, :identifier => #{@account}") end end diff --git a/spec/fixtures/finger_xrd b/spec/fixtures/finger_xrd index d897925e5..5ede32d74 100644 --- a/spec/fixtures/finger_xrd +++ b/spec/fixtures/finger_xrd @@ -1,9 +1,11 @@ - - - acct:tom@tom.joindiaspora.com - "http://tom.joindiaspora.com/" - - - - - + + + acct:tom@tom.joindiaspora.com + "http://tom.joindiaspora.com/" + + + + + + + diff --git a/spec/lib/webfinger_profile_spec.rb b/spec/lib/webfinger_profile_spec.rb index 497f67494..611a3e633 100644 --- a/spec/lib/webfinger_profile_spec.rb +++ b/spec/lib/webfinger_profile_spec.rb @@ -23,6 +23,12 @@ describe WebfingerProfile do it 'should handle a non-diaspora profile without blowing up' do proc{ WebfingerProfile.new("evan@status.net", not_diaspora_webfinger)}.should_not raise_error end + + [:links, :hcard, :guid, :seed_location, :public_key].each do |field| + it 'should sets the #{field} field' do + profile.send(field).should be_present + end + end end end