relax retention date validation on replication target (#15752)

This commit is contained in:
Poorna 2022-09-23 21:19:03 -07:00 committed by GitHub
parent b04c0697e1
commit 5fd5ddea23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -25,10 +25,13 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"net/textproto"
"strings" "strings"
"time" "time"
"github.com/beevik/ntp" "github.com/beevik/ntp"
xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger" "github.com/minio/minio/internal/logger"
"github.com/minio/pkg/env" "github.com/minio/pkg/env"
) )
@ -411,6 +414,7 @@ func ParseObjectLockRetentionHeaders(h http.Header) (rmode RetMode, r RetentionD
if err != nil { if err != nil {
return rmode, r, ErrInvalidRetentionDate return rmode, r, ErrInvalidRetentionDate
} }
_, replReq := h[textproto.CanonicalMIMEHeaderKey(xhttp.MinIOSourceReplicationRequest)]
t, err := UTCNowNTP() t, err := UTCNowNTP()
if err != nil { if err != nil {
@ -418,7 +422,7 @@ func ParseObjectLockRetentionHeaders(h http.Header) (rmode RetMode, r RetentionD
return rmode, r, ErrPastObjectLockRetainDate return rmode, r, ErrPastObjectLockRetainDate
} }
if retDate.Before(t) { if retDate.Before(t) && !replReq {
return rmode, r, ErrPastObjectLockRetainDate return rmode, r, ErrPastObjectLockRetainDate
} }