mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
Throw 404 for head requests for prefixes without trailing "/" (#5966)
Minio server returns 403 (access denied) for head requests to prefixes without trailing "/", this is different from S3 behaviour. S3 returns 404 in such cases. Fixes #6080
This commit is contained in:
parent
cd152f404a
commit
ad79c626c6
@ -199,7 +199,7 @@ func osErrToFSFileErr(err error) error {
|
|||||||
return errFileAccessDenied
|
return errFileAccessDenied
|
||||||
}
|
}
|
||||||
if isSysErrNotDir(err) {
|
if isSysErrNotDir(err) {
|
||||||
return errFileAccessDenied
|
return errFileNotFound
|
||||||
}
|
}
|
||||||
if isSysErrPathNotFound(err) {
|
if isSysErrPathNotFound(err) {
|
||||||
return errFileNotFound
|
return errFileNotFound
|
||||||
@ -218,8 +218,7 @@ func fsStatDir(ctx context.Context, statDir string) (os.FileInfo, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !fi.IsDir() {
|
if !fi.IsDir() {
|
||||||
logger.LogIf(ctx, errFileAccessDenied)
|
return nil, errFileNotFound
|
||||||
return nil, errFileAccessDenied
|
|
||||||
}
|
}
|
||||||
return fi, nil
|
return fi, nil
|
||||||
}
|
}
|
||||||
@ -244,8 +243,7 @@ func fsStatFile(ctx context.Context, statFile string) (os.FileInfo, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
logger.LogIf(ctx, errFileAccessDenied)
|
return nil, errFileNotFound
|
||||||
return nil, errFileAccessDenied
|
|
||||||
}
|
}
|
||||||
return fi, nil
|
return fi, nil
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ func TestFSStats(t *testing.T) {
|
|||||||
srcFSPath: path,
|
srcFSPath: path,
|
||||||
srcVol: "success-vol",
|
srcVol: "success-vol",
|
||||||
srcPath: "path",
|
srcPath: "path",
|
||||||
expectedErr: errFileAccessDenied,
|
expectedErr: errFileNotFound,
|
||||||
},
|
},
|
||||||
// Test case - 6.
|
// Test case - 6.
|
||||||
// Test case with src path segment > 255.
|
// Test case with src path segment > 255.
|
||||||
|
@ -696,7 +696,7 @@ func (fs *FSObjects) getObjectInfoWithLock(ctx context.Context, bucket, object s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, err := fs.statBucketDir(ctx, bucket); err != nil {
|
if _, err := fs.statBucketDir(ctx, bucket); err != nil {
|
||||||
return oi, toObjectErr(err, bucket)
|
return oi, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasSuffix(object, slashSeparator) && !fs.isObjectDir(bucket, object) {
|
if strings.HasSuffix(object, slashSeparator) && !fs.isObjectDir(bucket, object) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user