parentDirIsObject() to return quickly with inexistant parent (#11204)

Rewrite parentIsObject() function. Currently if a client uploads
a/b/c/d, we always check if c, b, a are actual objects or not.

The new code will check with the reverse order and quickly quit if 
the segment doesn't exist.

So if a, b, c in 'a/b/c' does not exist in the first place, then returns
false quickly.
This commit is contained in:
Anis Elleuch
2021-01-02 21:01:29 +01:00
committed by GitHub
parent 677e80c0f8
commit c9d502e6fa
6 changed files with 30 additions and 15 deletions

View File

@@ -66,6 +66,10 @@ func TestErasureParentDirIsObject(t *testing.T) {
parentIsObject: true,
objectName: objectName,
},
{
parentIsObject: false,
objectName: "new-dir",
},
{
parentIsObject: false,
objectName: "",