diff --git a/internal/fs/put.go b/internal/fs/put.go index 196a0911..6d39e2f9 100644 --- a/internal/fs/put.go +++ b/internal/fs/put.go @@ -20,12 +20,12 @@ var UploadTaskManager = task.NewTaskManager(3, func(tid *uint64) { // putAsTask add as a put task and return immediately func putAsTask(dstDirPath string, file model.FileStreamer) error { storage, dstDirActualPath, err := operations.GetStorageAndActualPath(dstDirPath) - if storage.Config().NoUpload { - return errors.WithStack(errs.UploadNotSupported) - } if err != nil { return errors.WithMessage(err, "failed get storage") } + if storage.Config().NoUpload { + return errors.WithStack(errs.UploadNotSupported) + } if file.NeedStore() { tempFile, err := utils.CreateTempFile(file) if err != nil { @@ -45,11 +45,11 @@ func putAsTask(dstDirPath string, file model.FileStreamer) error { // putDirect put the file and return after finish func putDirectly(ctx context.Context, dstDirPath string, file model.FileStreamer) error { storage, dstDirActualPath, err := operations.GetStorageAndActualPath(dstDirPath) - if storage.Config().NoUpload { - return errors.WithStack(errs.UploadNotSupported) - } if err != nil { return errors.WithMessage(err, "failed get storage") } + if storage.Config().NoUpload { + return errors.WithStack(errs.UploadNotSupported) + } return operations.Put(ctx, storage, dstDirActualPath, file, nil) }