mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-26 06:05:54 +03:00
[PR #2103] [MERGED] Fix metadata headers not being preserved during upload and retrieval #2098
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#2098
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fsouza/fake-gcs-server/pull/2103
Author: @louisnow
Created: 1/3/2026
Status: ✅ Merged
Merged: 2/14/2026
Merged by: @fsouza
Base:
main← Head:fix/metadata-preservation📝 Commits (6)
c8debf2fix: preserve HTTP metadata headers when storing and retrieving objects2f214b8fix: additional metadata preservation fixes and test coverage779d647fix: add contentEncoding and cacheControl to ComposeObject, fix gRPC gapsb325281test: add comprehensive test coverage for metadata preservation8456a77fix: preserve contentDisposition and contentLanguage in body-based resumable uploadsb6f0888fakestorage: stop setting Content-Type twice📊 Changes
9 files changed (+550 additions, -83 deletions)
View changed files
📝
fakestorage/object.go(+18 -4)📝
fakestorage/object_test.go(+92 -9)📝
fakestorage/upload.go(+93 -50)📝
fakestorage/upload_test.go(+287 -0)📝
internal/backend/fs.go(+3 -1)📝
internal/backend/memory.go(+3 -1)📝
internal/backend/storage.go(+1 -1)📝
internal/grpc/server.go(+34 -13)📝
internal/grpc/server_test.go(+19 -4)📄 Description
Summary
Fixes #2102 - Object metadata like Cache-Control, Content-Disposition, Content-Language, and custom
x-goog-meta-*headers were being silently dropped during uploads.The problem was that several upload handlers weren't reading these headers from the request or passing them through to the stored object. Additionally, Cache-Control wasn't being returned in JSON API responses, the gRPC server was missing metadata fields, and ComposeObject wasn't preserving encoding/cache settings.
Changes
JSON API response fixes:
cacheControlfield toobjectResponsestruct so it gets returned to clientscacheControltojsonObjectstruct and its JSON marshal/unmarshal methodscacheControltobufferedObjectsToBackendObjectsconversionmultipartMetadatastruct ("ContentLanguage"→"contentLanguage")Upload handler fixes:
x-goog-meta-*header supportObject operation fixes:
gRPC server fixes:
Tests:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.