Skip to content

Commit 7a24a55

Browse files
tsaitgaistpboling
authored andcommitted
server: fix param length check for decode
in the redmine plugin buri17/redmine_openid_provider, the following call: app/controllers/open_id_provider_controller.rb:28 open_id_request = server.decode_request(params) causes the following exception: NoMethodError (undefined method `length' for #<ActionController::Parameters:0x00007f3a14e70608>) params is a ActionController::Parameters. in rails 4.x ActionController::Parameters was a Hash and had the length method. in rails 5.x ActionController::Parameters is an object and does not have the length method. instead the empty? method can be used. this fix replaces "params.length == 0" with the equivalent "params.empty?"
1 parent 524eadf commit 7a24a55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/openid/server.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ def initialize(server)
12401240
# Raises ProtocolError when the query does not seem to be a valid
12411241
# OpenID request.
12421242
def decode(query)
1243-
if query.nil? or query.length == 0
1243+
if query.nil? or query.empty?
12441244
return nil
12451245
end
12461246

0 commit comments

Comments
 (0)