Skip to content

Commit 97d4114

Browse files
committed
fix: check err before check upload
1 parent d267c43 commit 97d4114

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

internal/fs/put.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ var UploadTaskManager = task.NewTaskManager(3, func(tid *uint64) {
2020
// putAsTask add as a put task and return immediately
2121
func putAsTask(dstDirPath string, file model.FileStreamer) error {
2222
storage, dstDirActualPath, err := operations.GetStorageAndActualPath(dstDirPath)
23-
if storage.Config().NoUpload {
24-
return errors.WithStack(errs.UploadNotSupported)
25-
}
2623
if err != nil {
2724
return errors.WithMessage(err, "failed get storage")
2825
}
26+
if storage.Config().NoUpload {
27+
return errors.WithStack(errs.UploadNotSupported)
28+
}
2929
if file.NeedStore() {
3030
tempFile, err := utils.CreateTempFile(file)
3131
if err != nil {
@@ -45,11 +45,11 @@ func putAsTask(dstDirPath string, file model.FileStreamer) error {
4545
// putDirect put the file and return after finish
4646
func putDirectly(ctx context.Context, dstDirPath string, file model.FileStreamer) error {
4747
storage, dstDirActualPath, err := operations.GetStorageAndActualPath(dstDirPath)
48-
if storage.Config().NoUpload {
49-
return errors.WithStack(errs.UploadNotSupported)
50-
}
5148
if err != nil {
5249
return errors.WithMessage(err, "failed get storage")
5350
}
51+
if storage.Config().NoUpload {
52+
return errors.WithStack(errs.UploadNotSupported)
53+
}
5454
return operations.Put(ctx, storage, dstDirActualPath, file, nil)
5555
}

0 commit comments

Comments
 (0)