fog / fog-azure-rm

Fog for Azure Resource Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't stream blob, Ruby 3+ raises exception without explicit &block in Proc.new

ttilberg opened this issue · comments

Similar to the issue in the AWS S3 adapter: fog/fog-aws@412677c

Ruby 3 has deprecated the ability to call Proc.new without a block explicitly passed in.

The api that streams blob contents uses this move, so does not work in Ruby 3+

https://github.com/fog/fog-azure-rm/blob/68ea3f7dd14c0a524146f1e426fa2ad1f6192cc8/lib/fog/azurerm/requests/storage/get_blob.rb#LL8C15-L8C15

It's already capturing the &block in the args anyway, and is an easy patch:

        def get_blob_with_block_given(container_name, blob_name, options, &_block)

Rather than implicit Proc.new:

            Proc.new.call('', 0, 0)

Pass the block explicitly.

            Proc.new(&_block).call('', 0, 0)

Updating each of the instances has allowed me to stream blobs down.