Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom metadata missing in Public and Signed URLs #1019 #1020

Merged
merged 2 commits into from Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions fakestorage/object.go
Expand Up @@ -809,6 +809,9 @@ func (s *Server) downloadObject(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Length", strconv.FormatInt(contentLength, 10))
w.Header().Set("X-Goog-Generation", strconv.FormatInt(obj.Generation, 10))
w.Header().Set("X-Goog-Hash", fmt.Sprintf("crc32c=%s,md5=%s", obj.Crc32c, obj.Md5Hash))
for name, element := range obj.Metadata {
w.Header().Set("X-Goog-Meta-"+name, element)
}
w.Header().Set("Last-Modified", obj.Updated.Format(http.TimeFormat))
fsouza marked this conversation as resolved.
Show resolved Hide resolved

if ranged && !satisfiable {
Expand Down
11 changes: 9 additions & 2 deletions fakestorage/object_test.go
Expand Up @@ -721,11 +721,18 @@ func TestServerClientObjectReaderError(t *testing.T) {

func TestServerClientObjectReadBucketCNAME(t *testing.T) {
url := "https://mybucket.mydomain.com:4443/files/txt/text-01.txt"
expectedHeaders := map[string]string{"accept-ranges": "bytes", "content-length": "9"}
expectedHeaders := map[string]string{"accept-ranges": "bytes", "content-length": "9", "x-goog-meta-marco": "Polo"}
expectedBody := "something"
opts := Options{
InitialObjects: []Object{
{ObjectAttrs: ObjectAttrs{BucketName: "mybucket.mydomain.com", Name: "files/txt/text-01.txt"}, Content: []byte("something")},
{
ObjectAttrs: ObjectAttrs{
BucketName: "mybucket.mydomain.com",
Name: "files/txt/text-01.txt",
Metadata: map[string]string{"Marco": "Polo"},
},
Content: []byte("something"),
},
},
}
server, err := NewServerWithOptions(opts)
Expand Down