mirror of
https://github.com/pgsty/minio.git
synced 2026-08-08 23:33:30 +03: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
+9
-2
@@ -73,6 +73,9 @@ func TestReadAll(t *testing.T) {
|
||||
if err = posix.AppendFile("exists", "as-file", []byte("Hello, World")); err != nil {
|
||||
t.Fatalf("Unable to create a file \"as-file\", %s", err)
|
||||
}
|
||||
if err = posix.AppendFile("exists", "as-file-parent", []byte("Hello, World")); err != nil {
|
||||
t.Fatalf("Unable to create a file \"as-file-parent\", %s", err)
|
||||
}
|
||||
|
||||
// Testcases to validate different conditions for ReadAll API.
|
||||
testCases := []struct {
|
||||
@@ -99,8 +102,12 @@ func TestReadAll(t *testing.T) {
|
||||
"as-directory",
|
||||
errFileNotFound,
|
||||
},
|
||||
// Validate the good condition file exists and we are able to
|
||||
// read it.
|
||||
{
|
||||
"exists",
|
||||
"as-file-parent/as-file",
|
||||
errFileNotFound,
|
||||
},
|
||||
// Validate the good condition file exists and we are able to read it.
|
||||
{
|
||||
"exists",
|
||||
"as-file",
|
||||
|
||||
Reference in New Issue
Block a user