[PR #1266] [MERGED] Omit items if empty in object list response #1342

Closed
opened 2026-03-03 12:34:09 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/1266
Author: @manuteleco
Created: 7/27/2023
Status: Merged
Merged: 7/29/2023
Merged by: @fsouza

Base: mainHead: omit_empty_items_in_object_list


📝 Commits (1)

  • b4d9732 Omit items if empty in object list response

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 fakestorage/response.go (+1 -1)

📄 Description

GCS does not include the items attribute in the response from the object list operation when it is empty (i.e., when there are no objects). With this commit we emulate that behavior.

Example responses from GCS:

$ curl 'https://storage.googleapis.com/storage/v1/b/<MY-BUCKET>/o/?prefix=nonexistent_path' -H "Authorization: Bearer <MY-TOKEN>"
{
  "kind": "storage#objects"
}
$ curl 'https://storage.googleapis.com/storage/v1/b/<MY-BUCKET>/o/?delimiter=%2F&prefix=only_dirs_inside%2F' -H "Authorization: Bearer <MY-TOKEN>"
{
  "kind": "storage#objects",
  "prefixes": [
    "only_dirs_inside/a_dir/"
  ]
}

🔄 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/1266 **Author:** [@manuteleco](https://github.com/manuteleco) **Created:** 7/27/2023 **Status:** ✅ Merged **Merged:** 7/29/2023 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `omit_empty_items_in_object_list` --- ### 📝 Commits (1) - [`b4d9732`](https://github.com/fsouza/fake-gcs-server/commit/b4d97327d5c853dd1bbe39413fa0ae89404bdf2c) Omit `items` if empty in object list response ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `fakestorage/response.go` (+1 -1) </details> ### 📄 Description GCS does not include the `items` attribute in the response from the [object list][1] operation when it is empty (i.e., when there are no objects). With this commit we emulate that behavior. Example responses from GCS: ```shell $ curl 'https://storage.googleapis.com/storage/v1/b/<MY-BUCKET>/o/?prefix=nonexistent_path' -H "Authorization: Bearer <MY-TOKEN>" { "kind": "storage#objects" } ``` ```shell $ curl 'https://storage.googleapis.com/storage/v1/b/<MY-BUCKET>/o/?delimiter=%2F&prefix=only_dirs_inside%2F' -H "Authorization: Bearer <MY-TOKEN>" { "kind": "storage#objects", "prefixes": [ "only_dirs_inside/a_dir/" ] } ``` [1]: https://cloud.google.com/storage/docs/json_api/v1/objects/list --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:34:09 +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#1342
No description provided.