mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(object): unmarshal may return nil althrough no error happend
Signed-off-by: leonrayang <chl696@sina.com>
This commit is contained in:
parent
8bb67c52ec
commit
7a739d82cf
@ -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)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user