diff --git a/app/models/api_key_scope.rb b/app/models/api_key_scope.rb index a0b86bf590b..b829ae479a6 100644 --- a/app/models/api_key_scope.rb +++ b/app/models/api_key_scope.rb @@ -120,7 +120,11 @@ class ApiKeyScope < ActiveRecord::Base defaults = route.defaults action = "#{defaults[:controller].to_s}##{defaults[:action]}" path = route.path.spec.to_s.gsub(/\(\.:format\)/, '') - api_supported_path = path.end_with?('.rss') || route.path.requirements[:format]&.match?('json') + api_supported_path = ( + path.end_with?('.rss') || + !route.path.requirements[:format] || + route.path.requirements[:format].match?('json') + ) excluded_paths = %w[/new-topic /new-message /exception] if actions.include?(action) && api_supported_path && !excluded_paths.include?(path)