Skip to content
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 Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rescue LoadError
puts "Hiding spec tasks because RSpec is not available"
end

require 'rake/rdoctask'
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

Expand Down
13 changes: 11 additions & 2 deletions lib/casclient/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,18 @@ def hash_to_query(hash)
pairs = []
hash.each do |k, vals|
vals = [vals] unless vals.kind_of? Array
vals.each {|v| pairs << (v.nil? ? CGI.escape(k) : "#{CGI.escape(k)}=#{CGI.escape(v)}")}

vals.each {|v|
if v.nil?
pairs << CGI.escape(k) unless k.nil?
else
pairs << "#{CGI.escape(k)}=#{CGI.escape(v)}"
end

pairs
}
end
pairs.join("&")
end
end
end
end
8 changes: 8 additions & 0 deletions spec/casclient/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,12 @@
end
end
end

describe 'logout_url' do
it 'should tolerate oddly formed URIs' do
destination_url = 'https://foo.com/path/to/page?&sort=date_received.DESC'

client.logout_url(destination_url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the expected output of this call?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not too relevant, at least for this bug - the code throws an error, or doesn't. Happy to contribute other test coverage that targets the method in a separate pr

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, it's been three years and the underlying bug is still present - https://github.com/rubycas/rubycas-client/blob/master/lib/casclient/client.rb#L286

end
end
end