fs: Verify if parent is an object before i/o. (#4304)

PutObject() needs to verify and fail.

Fixes #4301
This commit is contained in:
Harshavardhana
2017-05-09 17:46:46 -07:00
committed by GitHub
parent 298b470f69
commit fa3f6d75b6
7 changed files with 108 additions and 23 deletions
+3 -2
View File
@@ -134,7 +134,7 @@ func TestFSStats(t *testing.T) {
srcFSPath: path,
srcVol: "success-vol",
srcPath: "path",
expectedErr: errFileNotFound,
expectedErr: errFileAccessDenied,
},
// Test case - 6.
// Test case with src path segment > 255.
@@ -167,7 +167,8 @@ func TestFSStats(t *testing.T) {
for i, testCase := range testCases {
if testCase.srcPath != "" {
if _, err := fsStatFile(pathJoin(testCase.srcFSPath, testCase.srcVol, testCase.srcPath)); errorCause(err) != testCase.expectedErr {
if _, err := fsStatFile(pathJoin(testCase.srcFSPath, testCase.srcVol,
testCase.srcPath)); errorCause(err) != testCase.expectedErr {
t.Fatalf("TestPosix case %d: Expected: \"%s\", got: \"%s\"", i+1, testCase.expectedErr, err)
}
} else {