mirror of
https://github.com/AlistGo/alist.git
synced 2025-04-22 21:04:07 +08:00
fix: check err before check upload
This commit is contained in:
parent
d267c43556
commit
97d4114e38
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user