From a11349e4564784f81d4d3a3131793d5454fd57fa Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Tue, 10 May 2022 22:46:28 +0200 Subject: [PATCH] added etag to metadata --- internal/s3/minio.go | 1 + internal/types/types.go | 1 + internal/web/web.go | 3 +++ 3 files changed, 5 insertions(+) diff --git a/internal/s3/minio.go b/internal/s3/minio.go index f526382..ea4f7fc 100644 --- a/internal/s3/minio.go +++ b/internal/s3/minio.go @@ -65,5 +65,6 @@ func (m *minioClient) GetObjectMetadata(ctx context.Context, key string) (*types return &types.Metadata{ Size: object.Size, ContentType: object.ContentType, + ETag: object.ETag, }, nil } diff --git a/internal/types/types.go b/internal/types/types.go index 53ab430..588d605 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -18,4 +18,5 @@ type Metadata struct { Size int64 ContentType string Filename string + ETag string } diff --git a/internal/web/web.go b/internal/web/web.go index 7a3e76f..52fe838 100644 --- a/internal/web/web.go +++ b/internal/web/web.go @@ -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-Length", strconv.FormatInt(metadata.Size, 10)) w.Header().Set("Content-Disposition", "attachment; filename=\""+metadata.Filename+"\"") + if metadata.ETag != "" { + w.Header().Set("ETag", metadata.ETag) + } return share }