Skip to content

Commit

Permalink
Fix a bug related to character entities in URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manfred committed Feb 13, 2012
1 parent 43f0892 commit 6f6340e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/supreme/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def amount
end

def url
text('//URL')
# For some reason REXML doesn't process the character entities in the XML
text('//URL').gsub('&', '&')
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/supreme/uri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.encode_www_form_component(s)
str = s.to_s
if RUBY_VERSION < "1.9" && $KCODE =~ /u/i
str.gsub(/([^ a-zA-Z0-9_.-]+)/) do
'%' + $1.unpack('H2' * Rack::Utils.bytesize($1)).join('%').upcase
'%' + $1.unpack('H2' * $1.length).join('%').upcase
end.tr(' ', '+')
else
if TBLENCWWWCOMP_.empty?
Expand Down
2 changes: 1 addition & 1 deletion remote/basic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

puts
puts "Open the following link and complete the transaction: "
puts transaction.url.gsub('&amp;', '&')
puts transaction.url
puts

puts "Waiting 20 seconds for you to complete the payment"
Expand Down
2 changes: 1 addition & 1 deletion test/api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_fetch
assert transaction.kind_of?(Supreme::Transaction)
assert_equal '482d599bbcc7795727650330ad65fe9b', transaction.transaction_id
assert_equal '123', transaction.amount
assert_equal 'https://mijn.postbank.nl/internetbankieren/SesamLoginServlet?sessie=ideal&amp;trxid=003123456789123&amp;random=123456789abcdefgh', transaction.url
assert_equal 'https://mijn.postbank.nl/internetbankieren/SesamLoginServlet?sessie=ideal&trxid=003123456789123&random=123456789abcdefgh', transaction.url
assert !transaction.error?
end

Expand Down

0 comments on commit 6f6340e

Please sign in to comment.