Skip to content

Double-splat (**options) operator fails on hash with string keys in put_object() call #535

@jywarren

Description

@jywarren

We're seeing an error hash key "x-goog-acl" is not a Symbol in v1.15.0 (link to our PR):

https://sentry.io/share/issue/6fb1fbdfa23f417192acba7c65747e95/

It's related to the introduction of the ** "double splat" operator to this line 2 months ago in #523:

def put_object(bucket_name, object_name, data, options = {})

I believe it's redundant, in any case, since there's a default set in the function definition:

def put_object(bucket_name, object_name, data, options = {})

You can reproduce this behavior in the console with the same error occurring, just with dummy hashes:

2.6.6 :001 > puts {}

 => nil 
2.6.6 :002 > puts **{}

 => nil 
2.6.6 :003 > a = {}
 => {} 
2.6.6 :004 > a['one'] = 0
 => 0 
2.6.6 :005 > puts a
{"one"=>0}
 => nil 
2.6.6 :006 > puts **a
Traceback (most recent call last):
        4: from /home/warren/.rvm/rubies/ruby-2.6.6/bin/irb:23:in `<main>'
        3: from /home/warren/.rvm/rubies/ruby-2.6.6/bin/irb:23:in `load'
        2: from /home/warren/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        1: from (irb):6
TypeError (hash key "one" is not a Symbol)
2.6.6 :007 > b = {}
 => {} 
2.6.6 :008 > b[:one] = 0
 => 0 
2.6.6 :009 > puts b
{:one=>0}
 => nil 
2.6.6 :010 > puts **b
{:one=>0}
 => nil 

Thanks for the fog library, we really appreciate your hard work on it!!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions