Skip to content

Commit

Permalink
api: getObject ObjectInfo should set metadata headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored and minio-trusted committed Jul 6, 2017
1 parent 5ca66c9 commit 9a33881
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
18 changes: 12 additions & 6 deletions api-get-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,18 @@ func (c Client) getObject(bucketName, objectName string, reqHeaders RequestHeade
if contentType == "" {
contentType = "application/octet-stream"
}
var objectStat ObjectInfo
objectStat.ETag = md5sum
objectStat.Key = objectName
objectStat.Size = resp.ContentLength
objectStat.LastModified = date
objectStat.ContentType = contentType

objectStat := ObjectInfo{
ETag: md5sum,
Key: objectName,
Size: resp.ContentLength,
LastModified: date,
ContentType: contentType,
// Extract only the relevant header keys describing the object.
// following function filters out a list of standard set of keys
// which are not part of object metadata.
Metadata: extractObjMetadata(resp.Header),
}

// do not close body here, caller will close
return resp.Body, objectStat, nil
Expand Down
10 changes: 4 additions & 6 deletions api-stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,16 @@ func (c Client) statObject(bucketName, objectName string, reqHeaders RequestHead
contentType = "application/octet-stream"
}

// Extract only the relevant header keys describing the object.
// following function filters out a list of standard set of keys
// which are not part of object metadata.
metadata := extractObjMetadata(resp.Header)

// Save object metadata info.
return ObjectInfo{
ETag: md5sum,
Key: objectName,
Size: size,
LastModified: date,
ContentType: contentType,
Metadata: metadata,
// Extract only the relevant header keys describing the object.
// following function filters out a list of standard set of keys
// which are not part of object metadata.
Metadata: extractObjMetadata(resp.Header),
}, nil
}

0 comments on commit 9a33881

Please sign in to comment.