mirror of https://github.com/minio/minio.git
fix: on windows avoid ':' as part of the object name (#19907)
fixes #18865 avoid-colon
This commit is contained in:
parent
614981e566
commit
55aa431578
|
@ -1633,7 +1633,7 @@ func (a adminAPIHandlers) StartBatchJob(w http.ResponseWriter, r *http.Request)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
job.ID = fmt.Sprintf("%s%s%d", shortuuid.New(), getBatchJobIDSeparator(), GetProxyEndpointLocalIndex(globalProxyEndpoints))
|
job.ID = fmt.Sprintf("%s%s%d", shortuuid.New(), getKeySeparator(), GetProxyEndpointLocalIndex(globalProxyEndpoints))
|
||||||
job.User = user
|
job.User = user
|
||||||
job.Started = time.Now()
|
job.Started = time.Now()
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -289,12 +288,3 @@ func (s *BatchJobSize) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
*s = BatchJobSize(sz)
|
*s = BatchJobSize(sz)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getBatchJobIDSeparator - returns the separator to be used in the batch job ID
|
|
||||||
// windows requires `_` as the separator `:` will be an invalid one
|
|
||||||
func getBatchJobIDSeparator() string {
|
|
||||||
if runtime.GOOS == globalWindowsOSName {
|
|
||||||
return "_"
|
|
||||||
}
|
|
||||||
return ":"
|
|
||||||
}
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ func parseRequestToken(token string) (subToken string, nodeIndex int) {
|
||||||
if token == "" {
|
if token == "" {
|
||||||
return token, -1
|
return token, -1
|
||||||
}
|
}
|
||||||
i := strings.Index(token, getBatchJobIDSeparator())
|
i := strings.Index(token, getKeySeparator())
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
return token, -1
|
return token, -1
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,18 @@ const (
|
||||||
compMinIndexSize = 8 << 20
|
compMinIndexSize = 8 << 20
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// getkeyeparator - returns the separator to be used for
|
||||||
|
// persisting on drive.
|
||||||
|
//
|
||||||
|
// - ":" is used on non-windows platforms
|
||||||
|
// - "_" is used on windows platforms
|
||||||
|
func getKeySeparator() string {
|
||||||
|
if runtime.GOOS == globalWindowsOSName {
|
||||||
|
return "_"
|
||||||
|
}
|
||||||
|
return ":"
|
||||||
|
}
|
||||||
|
|
||||||
// isMinioBucket returns true if given bucket is a MinIO internal
|
// isMinioBucket returns true if given bucket is a MinIO internal
|
||||||
// bucket and false otherwise.
|
// bucket and false otherwise.
|
||||||
func isMinioMetaBucketName(bucket string) bool {
|
func isMinioMetaBucketName(bucket string) bool {
|
||||||
|
|
|
@ -865,7 +865,7 @@ func (sts *stsAPIHandlers) AssumeRoleWithCertificate(w http.ResponseWriter, r *h
|
||||||
}
|
}
|
||||||
|
|
||||||
// Associate any service accounts to the certificate CN
|
// Associate any service accounts to the certificate CN
|
||||||
parentUser := "tls:" + certificate.Subject.CommonName
|
parentUser := "tls" + getKeySeparator() + certificate.Subject.CommonName
|
||||||
|
|
||||||
claims[expClaim] = UTCNow().Add(expiry).Unix()
|
claims[expClaim] = UTCNow().Add(expiry).Unix()
|
||||||
claims[subClaim] = certificate.Subject.CommonName
|
claims[subClaim] = certificate.Subject.CommonName
|
||||||
|
@ -990,7 +990,7 @@ func (sts *stsAPIHandlers) AssumeRoleWithCustomToken(w http.ResponseWriter, r *h
|
||||||
expiry = requestedDuration
|
expiry = requestedDuration
|
||||||
}
|
}
|
||||||
|
|
||||||
parentUser := "custom:" + res.Success.User
|
parentUser := "custom" + getKeySeparator() + res.Success.User
|
||||||
|
|
||||||
// metadata map
|
// metadata map
|
||||||
claims[expClaim] = UTCNow().Add(time.Duration(expiry) * time.Second).Unix()
|
claims[expClaim] = UTCNow().Add(time.Duration(expiry) * time.Second).Unix()
|
||||||
|
|
Loading…
Reference in New Issue