From 387a41a4f1446da67a7877f50c5e916163b5f764 Mon Sep 17 00:00:00 2001 From: tide-wait Date: Mon, 25 May 2026 09:33:48 +0800 Subject: [PATCH 1/5] fix(op): apply Temp mask to all Copy/Move cache entries When a driver implementing CopyResult returns the source object instead of the actual new copy (e.g. 115_open), the directory cache was populated without a Temp mask. Subsequent Rename operations using excludeTempObj=true would hit the stale cache entry carrying the source file ID, causing the rename to target the source file instead of the copy. This ensures all post-copy and post-move cache entries carry the Temp flag, allowing Rename and Move to correctly trigger a fresh list via the existing excludeTempObj mechanism. --- internal/op/fs.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/op/fs.go b/internal/op/fs.go index f7b1c45b5..0f515af57 100644 --- a/internal/op/fs.go +++ b/internal/op/fs.go @@ -426,10 +426,11 @@ func Move(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string } if cache, exist := Cache.dirCache.Get(dstKey); exist { if newObj == nil { - newObj = &model.ObjWrapMask{Obj: srcRawObj, Mask: model.Temp} + newObj = srcRawObj } else { newObj = wrapObjName(storage, newObj) } + newObj = &model.ObjWrapMask{Obj: newObj, Mask: model.Temp} cache.UpdateObject(srcRawObj.GetName(), newObj) } } @@ -551,10 +552,11 @@ func Copy(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string if !storage.Config().NoCache { if cache, exist := Cache.dirCache.Get(dstKey); exist { if newObj == nil { - newObj = &model.ObjWrapMask{Obj: srcRawObj, Mask: model.Temp} + newObj = srcRawObj } else { newObj = wrapObjName(storage, newObj) } + newObj = &model.ObjWrapMask{Obj: newObj, Mask: model.Temp} cache.UpdateObject(srcRawObj.GetName(), newObj) } } From 7e4495d97cc673c5c55161378764d457646c70fd Mon Sep 17 00:00:00 2001 From: tide-wait Date: Mon, 25 May 2026 09:33:54 +0800 Subject: [PATCH 2/5] fix(115_open): handle GetFolderInfoByPath response format change The 115 Open API endpoint folder/get_info now returns the data field as a JSON array instead of a single object. The SDK (115-sdk-go v0.2.3) still unmarshals into a single struct, causing a "cannot unmarshal array" error. Catch this error in the driver Get method and return errs.NotSupport, which causes the upper-level op.Get to fall back to listing the parent directory to resolve the target object. --- drivers/115_open/driver.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/115_open/driver.go b/drivers/115_open/driver.go index 278ae0f7f..4933c1390 100644 --- a/drivers/115_open/driver.go +++ b/drivers/115_open/driver.go @@ -14,6 +14,7 @@ import ( "github.com/OpenListTeam/OpenList/v4/cmd/flags" "github.com/OpenListTeam/OpenList/v4/drivers/base" "github.com/OpenListTeam/OpenList/v4/internal/driver" + "github.com/OpenListTeam/OpenList/v4/internal/errs" "github.com/OpenListTeam/OpenList/v4/internal/model" "github.com/OpenListTeam/OpenList/v4/internal/op" "github.com/OpenListTeam/OpenList/v4/internal/stream" @@ -169,6 +170,9 @@ func (d *Open115) Get(ctx context.Context, path string) (model.Obj, error) { path = stdpath.Join(d.parentPath, path) resp, err := d.client.GetFolderInfoByPath(ctx, path) if err != nil { + if strings.Contains(err.Error(), "cannot unmarshal array") { + return nil, errs.NotSupport + } return nil, err } return &Obj{ From 050bb5bb053b439538436a49e5e457e836e27c8c Mon Sep 17 00:00:00 2001 From: tide-wait Date: Mon, 25 May 2026 21:00:26 +0800 Subject: [PATCH 3/5] style: go fmt --- drivers/115_open/driver.go | 2 +- drivers/115_open/types.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/115_open/driver.go b/drivers/115_open/driver.go index 4933c1390..b7632f761 100644 --- a/drivers/115_open/driver.go +++ b/drivers/115_open/driver.go @@ -222,7 +222,7 @@ func (d *Open115) Rename(ctx context.Context, srcObj model.Obj, newName string) return nil, err } _, err := d.client.UpdateFile(ctx, &sdk.UpdateFileReq{ - FileID: srcObj.GetID(), + FileID: srcObj.GetID(), FileName: newName, }) if err != nil { diff --git a/drivers/115_open/types.go b/drivers/115_open/types.go index 0bd95bfd1..493772a58 100644 --- a/drivers/115_open/types.go +++ b/drivers/115_open/types.go @@ -3,9 +3,9 @@ package _115_open import ( "time" + sdk "github.com/OpenListTeam/115-sdk-go" "github.com/OpenListTeam/OpenList/v4/internal/model" "github.com/OpenListTeam/OpenList/v4/pkg/utils" - sdk "github.com/OpenListTeam/115-sdk-go" ) type Obj sdk.GetFilesResp_File From 62787eb04a54bd80795f93c19a42d10852ee109d Mon Sep 17 00:00:00 2001 From: j2rong4cn Date: Sun, 31 May 2026 00:14:45 +0800 Subject: [PATCH 4/5] fix(115_open): simplify Move and Copy methods to return error directly --- drivers/115_open/driver.go | 21 ++++++++------------- internal/op/fs.go | 6 ++---- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/115_open/driver.go b/drivers/115_open/driver.go index b7632f761..16eb8c0a7 100644 --- a/drivers/115_open/driver.go +++ b/drivers/115_open/driver.go @@ -203,18 +203,15 @@ func (d *Open115) MakeDir(ctx context.Context, parentDir model.Obj, dirName stri }, nil } -func (d *Open115) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error) { +func (d *Open115) Move(ctx context.Context, srcObj, dstDir model.Obj) error { if err := d.WaitLimit(ctx); err != nil { - return nil, err + return err } _, err := d.client.Move(ctx, &sdk.MoveReq{ FileIDs: srcObj.GetID(), ToCid: dstDir.GetID(), }) - if err != nil { - return nil, err - } - return srcObj, nil + return err } func (d *Open115) Rename(ctx context.Context, srcObj model.Obj, newName string) (model.Obj, error) { @@ -231,23 +228,21 @@ func (d *Open115) Rename(ctx context.Context, srcObj model.Obj, newName string) obj, ok := srcObj.(*Obj) if ok { obj.Fn = newName + return srcObj, nil } - return srcObj, nil + return nil, nil } -func (d *Open115) Copy(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error) { +func (d *Open115) Copy(ctx context.Context, srcObj, dstDir model.Obj) error { if err := d.WaitLimit(ctx); err != nil { - return nil, err + return err } _, err := d.client.Copy(ctx, &sdk.CopyReq{ PID: dstDir.GetID(), FileID: srcObj.GetID(), NoDupli: "1", }) - if err != nil { - return nil, err - } - return srcObj, nil + return err } func (d *Open115) Remove(ctx context.Context, obj model.Obj) error { diff --git a/internal/op/fs.go b/internal/op/fs.go index 0f515af57..f7b1c45b5 100644 --- a/internal/op/fs.go +++ b/internal/op/fs.go @@ -426,11 +426,10 @@ func Move(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string } if cache, exist := Cache.dirCache.Get(dstKey); exist { if newObj == nil { - newObj = srcRawObj + newObj = &model.ObjWrapMask{Obj: srcRawObj, Mask: model.Temp} } else { newObj = wrapObjName(storage, newObj) } - newObj = &model.ObjWrapMask{Obj: newObj, Mask: model.Temp} cache.UpdateObject(srcRawObj.GetName(), newObj) } } @@ -552,11 +551,10 @@ func Copy(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string if !storage.Config().NoCache { if cache, exist := Cache.dirCache.Get(dstKey); exist { if newObj == nil { - newObj = srcRawObj + newObj = &model.ObjWrapMask{Obj: srcRawObj, Mask: model.Temp} } else { newObj = wrapObjName(storage, newObj) } - newObj = &model.ObjWrapMask{Obj: newObj, Mask: model.Temp} cache.UpdateObject(srcRawObj.GetName(), newObj) } } From 851e6d77653c0f4a6b4a3d2b51100d62e7462539 Mon Sep 17 00:00:00 2001 From: j2rong4cn Date: Wed, 3 Jun 2026 16:51:10 +0800 Subject: [PATCH 5/5] remove unused error handling for unmarshal array --- drivers/115_open/driver.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/115_open/driver.go b/drivers/115_open/driver.go index 16eb8c0a7..4d8061738 100644 --- a/drivers/115_open/driver.go +++ b/drivers/115_open/driver.go @@ -14,7 +14,6 @@ import ( "github.com/OpenListTeam/OpenList/v4/cmd/flags" "github.com/OpenListTeam/OpenList/v4/drivers/base" "github.com/OpenListTeam/OpenList/v4/internal/driver" - "github.com/OpenListTeam/OpenList/v4/internal/errs" "github.com/OpenListTeam/OpenList/v4/internal/model" "github.com/OpenListTeam/OpenList/v4/internal/op" "github.com/OpenListTeam/OpenList/v4/internal/stream" @@ -170,9 +169,6 @@ func (d *Open115) Get(ctx context.Context, path string) (model.Obj, error) { path = stdpath.Join(d.parentPath, path) resp, err := d.client.GetFolderInfoByPath(ctx, path) if err != nil { - if strings.Contains(err.Error(), "cannot unmarshal array") { - return nil, errs.NotSupport - } return nil, err } return &Obj{