fix(copy): use Link and Put when the driver does not support copying (#7834)

pull/7851/head
KirCute_ECT 2025-01-18 23:52:02 +08:00 committed by GitHub
parent 59e02287b2
commit 11b6a6012f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package fs
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/alist-org/alist/v3/internal/errs"
"net/http" "net/http"
stdpath "path" stdpath "path"
"time" "time"
@ -69,7 +70,10 @@ func _copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool
} }
// copy if in the same storage, just call driver.Copy // copy if in the same storage, just call driver.Copy
if srcStorage.GetStorage() == dstStorage.GetStorage() { if srcStorage.GetStorage() == dstStorage.GetStorage() {
return nil, op.Copy(ctx, srcStorage, srcObjActualPath, dstDirActualPath, lazyCache...) err = op.Copy(ctx, srcStorage, srcObjActualPath, dstDirActualPath, lazyCache...)
if !errors.Is(err, errs.NotImplement) && !errors.Is(err, errs.NotSupport) {
return nil, err
}
} }
if ctx.Value(conf.NoTaskKey) != nil { if ctx.Value(conf.NoTaskKey) != nil {
srcObj, err := op.Get(ctx, srcStorage, srcObjActualPath) srcObj, err := op.Get(ctx, srcStorage, srcObjActualPath)