mirror of https://github.com/minio/minio.git
do not proxy invalid object names (#20031)
This commit is contained in:
parent
2ec1f404ac
commit
be84a4fd68
|
@ -6,5 +6,5 @@ export GORACE="history_size=7"
|
|||
export MINIO_API_REQUESTS_MAX=10000
|
||||
|
||||
for d in $(go list ./...); do
|
||||
CGO_ENABLED=1 go test -v -race -short --timeout 100m "$d"
|
||||
CGO_ENABLED=1 go test -v -race --timeout 100m "$d"
|
||||
done
|
||||
|
|
|
@ -751,6 +751,12 @@ func isErrSignatureDoesNotMatch(err error) bool {
|
|||
return errors.As(err, &signatureDoesNotMatch)
|
||||
}
|
||||
|
||||
// isErrObjectNameInvalid - Check if error type is ObjectNameInvalid.
|
||||
func isErrObjectNameInvalid(err error) bool {
|
||||
var invalidObject ObjectNameInvalid
|
||||
return errors.As(err, &invalidObject)
|
||||
}
|
||||
|
||||
// PreConditionFailed - Check if copy precondition failed
|
||||
type PreConditionFailed struct{}
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj
|
|||
perr error
|
||||
)
|
||||
// avoid proxying if version is a delete marker
|
||||
if !isErrMethodNotAllowed(err) && !(gr != nil && gr.ObjInfo.DeleteMarker) {
|
||||
if !isErrObjectNameInvalid(err) && !isErrMethodNotAllowed(err) && !(gr != nil && gr.ObjInfo.DeleteMarker) {
|
||||
proxytgts := getProxyTargets(ctx, bucket, object, opts)
|
||||
if !proxytgts.Empty() {
|
||||
globalReplicationStats.incProxy(bucket, getObjectAPI, false)
|
||||
|
@ -1028,7 +1028,7 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob
|
|||
|
||||
objInfo, err := getObjectInfo(ctx, bucket, object, opts)
|
||||
var proxy proxyResult
|
||||
if err != nil && !objInfo.DeleteMarker && !isErrMethodNotAllowed(err) {
|
||||
if err != nil && !objInfo.DeleteMarker && !isErrMethodNotAllowed(err) && !isErrObjectNameInvalid(err) {
|
||||
// proxy HEAD to replication target if active-active replication configured on bucket
|
||||
proxytgts := getProxyTargets(ctx, bucket, object, opts)
|
||||
if !proxytgts.Empty() {
|
||||
|
|
Loading…
Reference in New Issue