Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contacts::Hotmail emails are not escaped and have some junk #22

Open
wants to merge 2 commits 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 contacts.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Gem::Specification.new do |s|
s.description = "A universal interface to grab contact list information from various providers including Yahoo, AOL, Gmail, Hotmail, and Plaxo."
s.has_rdoc = false
s.authors = ["Lucas Carlson"]
s.files = ["LICENSE", "Rakefile", "README", "examples/grab_contacts.rb", "lib/contacts.rb", "lib/contacts/base.rb", "lib/contacts/json_picker.rb", "lib/contacts/gmail.rb", "lib/contacts/aol.rb", "lib/contacts/hotmail.rb", "lib/contacts/plaxo.rb", "lib/contacts/yahoo.rb"]
s.files = ["LICENSE", "Rakefile", "README", "examples/grab_contacts.rb", "lib/contacts.rb", "lib/contacts/base.rb", "lib/contacts/json_picker.rb", "lib/contacts/gmail.rb", "lib/contacts/aol.rb", "lib/contacts/hotmail.rb", "lib/contacts/plaxo.rb", "lib/contacts/yahoo.rb", "lib/contacts/mailru.rb"]
s.add_dependency("json", ">= 1.1.1")
s.add_dependency('gdata', '>= 1.1.1')
end
8 changes: 5 additions & 3 deletions lib/contacts/hotmail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def contacts(options = {})
# Grab info
case c_info[1]
when "e" # Email
build_contacts.last[1] = row.match(/#{email_match_text_beginning}(.*)#{email_match_text_end}/)[1]
build_contacts.last[1] = row.match(/#{email_match_text_beginning}(.*?)#{email_match_text_end}/)[1]
when "dn" # Name
build_contacts.last[0] = row.match(/<a[^>]*>(.+)<\/a>/)[1]
end
Expand All @@ -105,7 +105,9 @@ def contacts(options = {})
build_contacts.each do |contact|
unless contact[1].nil?
# Only return contacts with email addresses
contact[1] = CGI::unescape(contact[1])
while contact[1] =~ /((%[0-9a-fA-F]{2})+)/i do
contact[1] = CGI::unescape(contact[1])
end
@contacts << contact
end
end
Expand All @@ -122,4 +124,4 @@ def get_contact_list_url(index)

TYPES[:hotmail] = Hotmail
end
end
end