[PR #330] [MERGED] Fix bucket name validation to allow underscores #525

Closed
opened 2026-03-03 12:30:26 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/330
Author: @gh2k
Created: 9/17/2020
Status: Merged
Merged: 9/17/2020
Merged by: @fsouza

Base: mainHead: bucketname-regex


📝 Commits (1)

  • e7c8391 Fix bucket name validation to allow underscores

📊 Changes

2 files changed (+11 additions, -5 deletions)

View changed files

📝 fakestorage/bucket.go (+1 -1)
📝 fakestorage/bucket_test.go (+10 -4)

📄 Description

According to Google's bucket naming guidelines underscores in bucket names are OK.

This patch updates the validation regex to more closely match the guidelines, by:

  • Allowing underscores
  • Preventing non-alphanumeric characters at the start/end of names

I haven't added the length checks, or for the goog prefix, so these can still be created erroneously - but this should fix downstream projects that have broken because of the incorrect name validation change.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fsouza/fake-gcs-server/pull/330 **Author:** [@gh2k](https://github.com/gh2k) **Created:** 9/17/2020 **Status:** ✅ Merged **Merged:** 9/17/2020 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `bucketname-regex` --- ### 📝 Commits (1) - [`e7c8391`](https://github.com/fsouza/fake-gcs-server/commit/e7c8391f809ff6a50a1321f8255c3a22a638143f) Fix bucket name validation to allow underscores ### 📊 Changes **2 files changed** (+11 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `fakestorage/bucket.go` (+1 -1) 📝 `fakestorage/bucket_test.go` (+10 -4) </details> ### 📄 Description According to Google's [bucket naming guidelines](https://cloud.google.com/storage/docs/naming-buckets) underscores in bucket names are OK. This patch updates the validation regex to more closely match the guidelines, by: * Allowing underscores * Preventing non-alphanumeric characters at the start/end of names I haven't added the length checks, or for the `goog` prefix, so these can still be created erroneously - but this should fix downstream projects that have broken because of the incorrect name validation change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:30:26 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#525
No description provided.