[GH-ISSUE #1953] Unable to create empty folder with trailing slash #233

Open
opened 2026-03-03 12:09:20 +03:00 by kerem · 0 comments
Owner

Originally created by @jevolixy on GitHub (Apr 9, 2025).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1953

Hey,

we are trying to leverage this container to perform the unit tests for some of our GCS workflow running in a local docker container. And we have a test case that will create a object like a fs folder path something like rootDir/subDir/ with 0 byte. The code snippet looks like below:

bucketName := "test-bucket-name"
dirName := "my-folder/" // Note the trailing slash

bucket := client.Bucket(bucketName)
obj := bucket.Object(dirName)
writer := obj.NewWriter(ctx)

if err := writer.Close(); err != nil {
	log.Fatalf("Failed to create directory object: %v", err)
}

and it won't create anything I noticed the post request has the url with the trailing slash, I also tested this with real gcs and it works.
Could you please help point how we can fix this? thanks

Originally created by @jevolixy on GitHub (Apr 9, 2025). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1953 Hey, we are trying to leverage this container to perform the unit tests for some of our GCS workflow running in a local docker container. And we have a test case that will create a object like a fs folder path something like `rootDir/subDir/` with 0 byte. The code snippet looks like below: ``` bucketName := "test-bucket-name" dirName := "my-folder/" // Note the trailing slash bucket := client.Bucket(bucketName) obj := bucket.Object(dirName) writer := obj.NewWriter(ctx) if err := writer.Close(); err != nil { log.Fatalf("Failed to create directory object: %v", err) } ``` and it won't create anything I noticed the post request has the url with the trailing slash, I also tested this with real gcs and it works. Could you please help point how we can fix this? thanks
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#233
No description provided.