Skip to content

Commit

Permalink
Merge pull request #52 from gfx/avoid_500_if_auth_config_missing
Browse files Browse the repository at this point in the history
avoid nil errors in API authentication
  • Loading branch information
eisuke authored Apr 11, 2017
2 parents 3416466 + 303c818 commit 6a6e1a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/kuroko2/api/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def respond_with_error(status_code, error_code, message)
def api_authentication
service_name = authenticate_with_http_basic do |name, api_key|
stored = Kuroko2.config.api_basic_authentication_applications.try!(name.to_sym)
if Rack::Utils.secure_compare(api_key, stored)
if stored && Rack::Utils.secure_compare(api_key, stored)
name.to_sym
else
nil
Expand Down

0 comments on commit 6a6e1a8

Please sign in to comment.