added etag to metadata

This commit is contained in:
Djeeberjr 2022-05-10 22:46:28 +02:00
parent b5a326324f
commit a11349e456
3 changed files with 5 additions and 0 deletions

View File

@ -65,5 +65,6 @@ func (m *minioClient) GetObjectMetadata(ctx context.Context, key string) (*types
return &types.Metadata{ return &types.Metadata{
Size: object.Size, Size: object.Size,
ContentType: object.ContentType, ContentType: object.ContentType,
ETag: object.ETag,
}, nil }, nil
} }

View File

@ -18,4 +18,5 @@ type Metadata struct {
Size int64 Size int64
ContentType string ContentType string
Filename string Filename string
ETag string
} }

View File

@ -130,6 +130,9 @@ func getShareHead(client client.Client, w http.ResponseWriter, r *http.Request)
w.Header().Set("Content-Type", metadata.ContentType) w.Header().Set("Content-Type", metadata.ContentType)
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10)) w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))
w.Header().Set("Content-Disposition", "attachment; filename=\""+metadata.Filename+"\"") w.Header().Set("Content-Disposition", "attachment; filename=\""+metadata.Filename+"\"")
if metadata.ETag != "" {
w.Header().Set("ETag", metadata.ETag)
}
return share return share
} }