mirror of
https://github.com/minio/minio.git
synced 2025-04-22 03:24:38 -04:00
fix: Send x-amz-mp-parts-count for multiparted objects (#9116)
Some AWS SDKs latently rely on this value some times to calculate the right number of parts during a parallel GetObject request, this is feature used along with content-range - we should support this as well.
This commit is contained in:
parent
ed4bd20a7c
commit
a54cdb9587
@ -24,6 +24,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio/cmd/crypto"
|
"github.com/minio/minio/cmd/crypto"
|
||||||
@ -81,6 +82,10 @@ func setObjectHeaders(w http.ResponseWriter, objInfo ObjectInfo, rs *HTTPRangeSp
|
|||||||
w.Header()[xhttp.ETag] = []string{"\"" + objInfo.ETag + "\""}
|
w.Header()[xhttp.ETag] = []string{"\"" + objInfo.ETag + "\""}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.Contains(objInfo.ETag, "-") && len(objInfo.Parts) > 0 {
|
||||||
|
w.Header().Set(xhttp.AmzMpPartsCount, strconv.Itoa(len(objInfo.Parts)))
|
||||||
|
}
|
||||||
|
|
||||||
if objInfo.ContentType != "" {
|
if objInfo.ContentType != "" {
|
||||||
w.Header().Set(xhttp.ContentType, objInfo.ContentType)
|
w.Header().Set(xhttp.ContentType, objInfo.ContentType)
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,9 @@ const (
|
|||||||
AmzObjectLockLegalHold = "X-Amz-Object-Lock-Legal-Hold"
|
AmzObjectLockLegalHold = "X-Amz-Object-Lock-Legal-Hold"
|
||||||
AmzObjectLockBypassGovernance = "X-Amz-Bypass-Governance-Retention"
|
AmzObjectLockBypassGovernance = "X-Amz-Bypass-Governance-Retention"
|
||||||
|
|
||||||
|
// Multipart parts count
|
||||||
|
AmzMpPartsCount = "x-amz-mp-parts-count"
|
||||||
|
|
||||||
// Dummy putBucketACL
|
// Dummy putBucketACL
|
||||||
AmzACL = "x-amz-acl"
|
AmzACL = "x-amz-acl"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user