mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
Merge pull request #34 from fkautz/pr_out_adding_etag_to_headers
This commit is contained in:
commit
bd1df87bd3
@ -150,3 +150,9 @@ func isValidBucket(bucket string) bool {
|
|||||||
}
|
}
|
||||||
return valid
|
return valid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (storage *Storage) GetObjectMetadata(bucket, key string) mstorage.ObjectMetadata {
|
||||||
|
objectKey := bucket + ":" + key
|
||||||
|
|
||||||
|
return storage.objectdata[objectKey].metadata
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@ type Storage interface {
|
|||||||
ListBuckets(prefix string) []BucketMetadata
|
ListBuckets(prefix string) []BucketMetadata
|
||||||
|
|
||||||
// Object Operations
|
// Object Operations
|
||||||
|
GetObjectMetadata(bucket string, object string) ObjectMetadata
|
||||||
CopyObjectToWriter(w io.Writer, bucket string, object string) (int64, error)
|
CopyObjectToWriter(w io.Writer, bucket string, object string) (int64, error)
|
||||||
StoreObject(bucket string, key string, data io.Reader) error
|
StoreObject(bucket string, key string, data io.Reader) error
|
||||||
ListObjects(bucket, prefix string, count int) []ObjectMetadata
|
ListObjects(bucket, prefix string, count int) []ObjectMetadata
|
||||||
|
@ -55,6 +55,11 @@ func (server *minioApi) getObjectHandler(w http.ResponseWriter, req *http.Reques
|
|||||||
bucket := vars["bucket"]
|
bucket := vars["bucket"]
|
||||||
object := vars["object"]
|
object := vars["object"]
|
||||||
|
|
||||||
|
metadata := server.storage.GetObjectMetadata(bucket, object)
|
||||||
|
lastModifiedTime := time.Unix(metadata.SecCreated, 0)
|
||||||
|
lastModified := lastModifiedTime.Format(time.RFC1123)
|
||||||
|
w.Header().Set("ETag", metadata.ETag)
|
||||||
|
w.Header().Set("Last-Modified", lastModified)
|
||||||
_, err := server.storage.CopyObjectToWriter(w, bucket, object)
|
_, err := server.storage.CopyObjectToWriter(w, bucket, object)
|
||||||
switch err := err.(type) {
|
switch err := err.(type) {
|
||||||
case nil: // success
|
case nil: // success
|
||||||
|
Loading…
x
Reference in New Issue
Block a user