fog-google icon indicating copy to clipboard operation
fog-google copied to clipboard

Bucket names with dashes in them cause errors in mocks

Open mateomurphy opened this issue 2 years ago • 3 comments

I'm running into an issue when trying to mock google storage:

storage = Fog::Storage::Google.new({
  :google_storage_access_key_id => "id",
  :google_storage_secret_access_key => "key"
})

bucket = storage.directories.create(key: "name")

pp bucket.files.all # returns []

bucket = storage.directories.create(key: "name-with-dashes")

pp bucket.files.all # raises Excon::Error::BadRequest

This happens because this line of code rejects names that have non word characters in them: https://github.com/fog/fog-google/blob/master/lib/fog/storage/google_xml/requests/get_bucket.rb#L52

However according to google's documentation, dashes, underscores and dots are legal: https://cloud.google.com/storage/docs/buckets#naming

mateomurphy avatar Jun 30 '23 20:06 mateomurphy

BTW I forked and modified this, and can submit a PR if that would be helpful

mateomurphy avatar Jul 04 '23 16:07 mateomurphy

@mateomurphy very! Please do 🙏

Temikus avatar Aug 10 '23 07:08 Temikus