Project

General

Profile

Bug #16500

Updated by sawa (Tsuyoshi Sawada) almost 5 years ago

Here is a followup for a ruby2.7 issue discussed here https://gitlab.com/groups/gitlab-org/-/epics/2380 

 I run gitlab with ruby2.7. Things work mostly fine except one weird issue. gitlab/lib/api/api_guard.rb calls Rack's `use` method: 


 ```ruby 
 
   use Rack::OAuth2::Server::Resource::Bearer, 'The API' do |request| 
   
     # The authenticator only fetches the raw token string 

   

     # Must yield access token to store it in the env 
     request.access_token 
   request.access_token 
 end 
 

 ``` 

 The `use` method looks like: 

 like 
 ```ruby 
 
     def use(middleware, *args, &block) 
   
       if @map 
     
         mapping, @map = @map, nil 
       
         @use << proc { |app| generate_map app, mapping } 
   
       end 
   
       @use << proc { |app| middleware.new(app, *args, &block) } 
 
     end 
 ``` 

 For some reason, a reason `Proc` object was method set to `&block` *and* added to `args`. It sounds wrong. A `Proc` should only be set to `&block`, `&block` only and `args` should contain only one 1 argument.

Back