mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Remove some logs caused by external apps (#16027)
This commit is contained in:
parent
3b1a9b9fdf
commit
7260241511
@ -35,7 +35,7 @@ import (
|
|||||||
// - delimiter if set should be equal to '/', otherwise the request is rejected.
|
// - delimiter if set should be equal to '/', otherwise the request is rejected.
|
||||||
// - marker if set should have a common prefix with 'prefix' param, otherwise
|
// - marker if set should have a common prefix with 'prefix' param, otherwise
|
||||||
// the request is rejected.
|
// the request is rejected.
|
||||||
func validateListObjectsArgs(marker, delimiter, encodingType string, maxKeys int) APIErrorCode {
|
func validateListObjectsArgs(prefix, marker, delimiter, encodingType string, maxKeys int) APIErrorCode {
|
||||||
// Max keys cannot be negative.
|
// Max keys cannot be negative.
|
||||||
if maxKeys < 0 {
|
if maxKeys < 0 {
|
||||||
return ErrInvalidMaxKeys
|
return ErrInvalidMaxKeys
|
||||||
@ -48,6 +48,14 @@ func validateListObjectsArgs(marker, delimiter, encodingType string, maxKeys int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !IsValidObjectPrefix(prefix) {
|
||||||
|
return ErrInvalidObjectName
|
||||||
|
}
|
||||||
|
|
||||||
|
if marker != "" && !HasPrefix(marker, prefix) {
|
||||||
|
return ErrNotImplemented
|
||||||
|
}
|
||||||
|
|
||||||
return ErrNone
|
return ErrNone
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +91,7 @@ func (api objectAPIHandlers) ListObjectVersionsHandler(w http.ResponseWriter, r
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate the query params before beginning to serve the request.
|
// Validate the query params before beginning to serve the request.
|
||||||
if s3Error := validateListObjectsArgs(marker, delimiter, encodingType, maxkeys); s3Error != ErrNone {
|
if s3Error := validateListObjectsArgs(prefix, marker, delimiter, encodingType, maxkeys); s3Error != ErrNone {
|
||||||
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -148,7 +156,7 @@ func (api objectAPIHandlers) ListObjectsV2MHandler(w http.ResponseWriter, r *htt
|
|||||||
|
|
||||||
// Validate the query params before beginning to serve the request.
|
// Validate the query params before beginning to serve the request.
|
||||||
// fetch-owner is not validated since it is a boolean
|
// fetch-owner is not validated since it is a boolean
|
||||||
if s3Error := validateListObjectsArgs(token, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
if s3Error := validateListObjectsArgs(prefix, token, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
||||||
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -218,7 +226,7 @@ func (api objectAPIHandlers) ListObjectsV2Handler(w http.ResponseWriter, r *http
|
|||||||
|
|
||||||
// Validate the query params before beginning to serve the request.
|
// Validate the query params before beginning to serve the request.
|
||||||
// fetch-owner is not validated since it is a boolean
|
// fetch-owner is not validated since it is a boolean
|
||||||
if s3Error := validateListObjectsArgs(token, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
if s3Error := validateListObjectsArgs(prefix, token, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
||||||
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -325,7 +333,7 @@ func (api objectAPIHandlers) ListObjectsV1Handler(w http.ResponseWriter, r *http
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate all the query params before beginning to serve the request.
|
// Validate all the query params before beginning to serve the request.
|
||||||
if s3Error := validateListObjectsArgs(marker, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
if s3Error := validateListObjectsArgs(prefix, marker, delimiter, encodingType, maxKeys); s3Error != ErrNone {
|
||||||
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(s3Error), r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -533,6 +533,7 @@ func readAllXL(ctx context.Context, disks []StorageAPI, bucket, object string, r
|
|||||||
|
|
||||||
ignoredErrs := []error{
|
ignoredErrs := []error{
|
||||||
errFileNotFound,
|
errFileNotFound,
|
||||||
|
errFileNameTooLong,
|
||||||
errVolumeNotFound,
|
errVolumeNotFound,
|
||||||
errFileVersionNotFound,
|
errFileVersionNotFound,
|
||||||
errDiskNotFound,
|
errDiskNotFound,
|
||||||
|
@ -367,10 +367,6 @@ func getResource(path string, host string, domains []string) (string, error) {
|
|||||||
// If virtual-host-style is enabled construct the "resource" properly.
|
// If virtual-host-style is enabled construct the "resource" properly.
|
||||||
xhost, err := xnet.ParseHost(host)
|
xhost, err := xnet.ParseHost(host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
reqInfo := (&logger.ReqInfo{}).AppendTags("host", host)
|
|
||||||
reqInfo.AppendTags("path", path)
|
|
||||||
ctx := logger.SetReqInfo(context.Background(), reqInfo)
|
|
||||||
logger.LogIf(ctx, err)
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,16 +41,13 @@ func checkDelObjArgs(ctx context.Context, bucket, object string) error {
|
|||||||
func checkBucketAndObjectNames(ctx context.Context, bucket, object string) error {
|
func checkBucketAndObjectNames(ctx context.Context, bucket, object string) error {
|
||||||
// Verify if bucket is valid.
|
// Verify if bucket is valid.
|
||||||
if !isMinioMetaBucketName(bucket) && s3utils.CheckValidBucketName(bucket) != nil {
|
if !isMinioMetaBucketName(bucket) && s3utils.CheckValidBucketName(bucket) != nil {
|
||||||
logger.LogIf(ctx, BucketNameInvalid{Bucket: bucket})
|
|
||||||
return BucketNameInvalid{Bucket: bucket}
|
return BucketNameInvalid{Bucket: bucket}
|
||||||
}
|
}
|
||||||
// Verify if object is valid.
|
// Verify if object is valid.
|
||||||
if len(object) == 0 {
|
if len(object) == 0 {
|
||||||
logger.LogIf(ctx, ObjectNameInvalid{Bucket: bucket, Object: object})
|
|
||||||
return ObjectNameInvalid{Bucket: bucket, Object: object}
|
return ObjectNameInvalid{Bucket: bucket, Object: object}
|
||||||
}
|
}
|
||||||
if !IsValidObjectPrefix(object) {
|
if !IsValidObjectPrefix(object) {
|
||||||
logger.LogIf(ctx, ObjectNameInvalid{Bucket: bucket, Object: object})
|
|
||||||
return ObjectNameInvalid{Bucket: bucket, Object: object}
|
return ObjectNameInvalid{Bucket: bucket, Object: object}
|
||||||
}
|
}
|
||||||
if runtime.GOOS == globalWindowsOSName && strings.Contains(object, "\\") {
|
if runtime.GOOS == globalWindowsOSName && strings.Contains(object, "\\") {
|
||||||
|
Loading…
Reference in New Issue
Block a user