[PR #1519] [MERGED] Remove unnecessary quoting around ETag in JSON response #1571

Closed
opened 2026-03-03 12:35:13 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/1519
Author: @manuteleco
Created: 3/8/2024
Status: Merged
Merged: 3/13/2024
Merged by: @fsouza

Base: mainHead: fix_etag_rendering_in_response


📝 Commits (1)

  • 621ef3c Remove unnecessary quoting around ETag in JSON response

📊 Changes

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

View changed files

📝 fakestorage/object.go (+1 -1)
📝 fakestorage/object_test.go (+1 -1)
📝 fakestorage/upload.go (+1 -1)
📝 internal/backend/fs.go (+1 -1)
📝 internal/backend/memory.go (+1 -1)

📄 Description

The JSON marshaller will already escape the value appropriately. Quoting the value explicitly beforehand is counterproductive, as the quotes introduced in that step would be considered legitimate part of the ETag value and would be themselves escaped when marshalling.

When setting the ETag HTTP response header, however, we do have to explicitly add the quoting. This is because double quotes are not added automatically for HTTP headers and, according to the standard, the ETag header value must be wrapped in double quotes.

Fixes #1327


🔄 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/1519 **Author:** [@manuteleco](https://github.com/manuteleco) **Created:** 3/8/2024 **Status:** ✅ Merged **Merged:** 3/13/2024 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `fix_etag_rendering_in_response` --- ### 📝 Commits (1) - [`621ef3c`](https://github.com/fsouza/fake-gcs-server/commit/621ef3c2b2a785b7c7731414a3fbc9efb1546d8b) Remove unnecessary quoting around ETag in JSON response ### 📊 Changes **5 files changed** (+5 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `fakestorage/object.go` (+1 -1) 📝 `fakestorage/object_test.go` (+1 -1) 📝 `fakestorage/upload.go` (+1 -1) 📝 `internal/backend/fs.go` (+1 -1) 📝 `internal/backend/memory.go` (+1 -1) </details> ### 📄 Description The JSON marshaller will already escape the value appropriately. Quoting the value explicitly beforehand is counterproductive, as the quotes introduced in that step would be considered legitimate part of the ETag value and would be themselves escaped when marshalling. When setting the `ETag` HTTP response header, however, we do have to explicitly add the quoting. This is because double quotes are not added automatically for HTTP headers and, according to the [standard][1], the `ETag` header value _must_ be wrapped in double quotes. [1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag Fixes #1327 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:35:13 +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#1571
No description provided.