mirror of
https://github.com/minio/minio.git
synced 2025-11-25 20:16:10 -05:00
posix: ReadAll should handle the case when parent is not a dir. (#2163)
It can happen so that a read request can come for a file which already has a parent i.e a file. This fix handles this scenario - fixes #2047
This commit is contained in:
committed by
Anand Babu (AB) Periasamy
parent
d676e660c9
commit
de468f92ec
11
posix.go
11
posix.go
@@ -424,11 +424,14 @@ func (s *posix) ReadAll(volume, path string) (buf []byte, err error) {
|
||||
} else if os.IsPermission(err) {
|
||||
return nil, errFileAccessDenied
|
||||
} else if pathErr, ok := err.(*os.PathError); ok {
|
||||
if pathErr.Err == syscall.EISDIR {
|
||||
return nil, errFileNotFound
|
||||
} else if strings.Contains(pathErr.Err.Error(), "The handle is invalid") {
|
||||
// This case is special and needs to be handled for windows.
|
||||
switch pathErr.Err {
|
||||
case syscall.ENOTDIR, syscall.EISDIR:
|
||||
return nil, errFileNotFound
|
||||
default:
|
||||
if strings.Contains(pathErr.Err.Error(), "The handle is invalid") {
|
||||
// This case is special and needs to be handled for windows.
|
||||
return nil, errFileNotFound
|
||||
}
|
||||
}
|
||||
return nil, pathErr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user