Skip to content

Commit b28208b

Browse files
authored
fix(189pc): handle numeric res_code in RenameResp to fix JSON unmarshal error (#2489)
1 parent ffbbc1c commit b28208b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/189pc/driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func (y *Cloud189PC) Rename(ctx context.Context, srcObj model.Obj, newName strin
293293
req.SetContext(ctx).SetQueryParams(queryParam)
294294
}, nil, resp, isFamily)
295295
if err != nil {
296-
if resp.ResCode == "FileAlreadyExists" {
296+
if code, ok := resp.ResCode.(string); ok && code == "FileAlreadyExists" {
297297
return nil, errs.ObjectAlreadyExists
298298
}
299299
return nil, err

drivers/189pc/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ type RenameResp struct {
441441
ParentID int64 `json:"parentId"`
442442
Rev string `json:"rev"`
443443
Size int64 `json:"size"`
444-
ResCode string `json:"res_code"`
444+
ResCode any `json:"res_code"` // int or string
445445
}
446446

447447
func (r *RenameResp) toFile(f *Cloud189File) *Cloud189File {

0 commit comments

Comments
 (0)