Skip to content

Commit

Permalink
unravel reftracker html encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
jambun committed Jun 28, 2022
1 parent a771ce6 commit 2e3ff96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/model/reftracker_client.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'net/http'
require 'nokogiri'

class ReftrackerAPIException < StandardError; end

Expand All @@ -19,7 +20,8 @@ def self.get_question(question_no)
raise RecordNotFound.new("No Question for number #{question_no}")
end

resp
# decode and strip markup - phewee - reftracker is not being friendly here
Hash[resp.map {|k, v| [k, Nokogiri::XML.fragment(Nokogiri::XML.fragment(v).text.gsub('&', '&amp;')).text]}]
end


Expand Down

0 comments on commit 2e3ff96

Please sign in to comment.