lib/service_adaptors/amazon.rb in umlaut-3.0.0beta3 vs lib/service_adaptors/amazon.rb in umlaut-3.0.0beta4

- old
+ new

@@ -37,10 +37,11 @@ require 'nokogiri' require 'isbn' include MetadataHelper + include ActionView::Helpers::SanitizeHelper required_config_params :url, :api_key, :associate_tag attr_reader :url def initialize(config) @@ -179,11 +180,10 @@ # if we get an error from Amazon, return now. err = (aws.at("ItemLookupResponse/Items/Request/Errors/Error")) err = (aws.at("ItemLookupErrorResponse")) if err.blank? - debugger unless (err.blank?) if (err.at('Code').text == 'AWS.InvalidParameterValue') # Indicates an ISBN that Amazon doesn't know about, or that # was mal-formed. We can't tell the difference, so either # way let's silently ignore. @@ -225,21 +225,21 @@ # get description if ( @service_types.include?("abstract") && desc = (aws.at("ItemLookupResponse/Items/Item/EditorialReviews/EditorialReview/Content"))) + + desc_text = desc.inner_text - # For some reason we need to un-escape the desc. Don't entirely get it. - desc_text = CGI.unescapeHTML( desc.inner_text ) - unless ( desc_text.blank? ) request.add_service_response( :service=>self, :display_text => "Description from Amazon.com", :url => item_url, :key=>'abstract', :value_string=>asin, - :content=>desc_text , + :content=> sanitize(desc_text) , + :content_html_safe => true, :service_type_value => 'abstract') end end