@@ -20,12 +20,12 @@ var UploadTaskManager = task.NewTaskManager(3, func(tid *uint64) {
2020// putAsTask add as a put task and return immediately
2121func 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
4646func 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