fix(object): unmarshal may return nil althrough no error happend

Signed-off-by: leonrayang <chl696@sina.com>
This commit is contained in:
leonrayang 2023-12-09 13:44:19 +08:00 committed by leonrayang
parent 8bb67c52ec
commit 7a739d82cf

View File

@ -17,6 +17,7 @@ package objectnode
import (
"encoding/json"
"encoding/xml"
"fmt"
"io"
"net/http"
"strings"
@ -196,6 +197,9 @@ func getObjectACL(vol *Volume, path string, needDefault bool) (*AccessControlPol
if err = json.Unmarshal(data, &acp); err != nil {
err = xml.Unmarshal(data, &acp)
}
if err == nil && acp == nil {
err = fmt.Errorf("data unmarshal failed")
}
} else if needDefault {
acp = CreateDefaultACL(vol.owner)
}