Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:andrewrjones/ruby-duck-duck-go

  • Loading branch information...
commit b5b631f7cf1e7db251d290641450581a24fa4838 2 parents 899a1f3 + b36446c
@andrewrjones authored
View
8 lib/duck_duck_go/zero_click_info.rb
@@ -42,14 +42,14 @@ def self.by(result)
abstract = result['Abstract'] unless result['Abstract'].empty?
abstract_text = result['AbstractText'] unless result['AbstractText'].empty?
abstract_source = result['AbstractSource'] unless result['AbstractSource'].empty?
- abstract_url = URI.parse(result['AbstractURL']) unless result['AbstractURL'].empty?
- image = URI.parse(result['Image']) unless result['Image'].empty?
+ abstract_url = URI.parse(URI.escape(result['AbstractURL'])) unless result['AbstractURL'].empty?
+ image = URI.parse(URI.escape(result['Image'])) unless result['Image'].empty?
heading = result['Heading'] unless result['Heading'].empty?
answer = result['Answer'] unless result['Answer'].empty?
answer_type = result['AnswerType'] unless result['AnswerType'].empty?
definition = result['Definition'] unless result['Definition'].empty?
definition_source = result['DefinitionSource'] unless result['DefinitionSource'].empty?
- definition_url = URI.parse(result['DefinitionURL']) unless result['DefinitionURL'].empty?
+ definition_url = URI.parse(URI.escape(result['DefinitionURL'])) unless result['DefinitionURL'].empty?
type = result['Type'] unless result['Type'].empty?
if result['Results']
@@ -79,4 +79,4 @@ def self.by(result)
end
end
-end
+end
View
2  test/tc_zero_click_info.rb
@@ -799,7 +799,7 @@ def test_zci_exclusive
"AbstractURL"=>"http://en.wikipedia.org/wiki/Lorem_Ipsum",
"Image"=>"",
"DefinitionURL"=>
- "http://www.thefreedictionary.com/_/search.aspx?pid=aff18&word=lorem%2520ipsum",
+ "http://www.merriam-webster.com/dictionary/lorem ipsum",
"DefinitionSource"=>"TheFreeDictionary",
"AbstractText"=>"",
"Type"=>"E"}
Please sign in to comment.
Something went wrong with that request. Please try again.