chore: close stream after put
This commit is contained in:
parent
ffa0bc294a
commit
3a1fcbef1c
@ -3,6 +3,7 @@ package operations
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/alist-org/alist/v3/internal/errs"
|
"github.com/alist-org/alist/v3/internal/errs"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
stdpath "path"
|
stdpath "path"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -195,6 +196,11 @@ func Remove(ctx context.Context, account driver.Driver, path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Put(ctx context.Context, account driver.Driver, dstDirPath string, file model.FileStreamer, up driver.UpdateProgress) error {
|
func Put(ctx context.Context, account driver.Driver, dstDirPath string, file model.FileStreamer, up driver.UpdateProgress) error {
|
||||||
|
defer func() {
|
||||||
|
if err := file.Close(); err != nil {
|
||||||
|
log.Errorf("failed to close file streamer, %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
err := MakeDir(ctx, account, dstDirPath)
|
err := MakeDir(ctx, account, dstDirPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessagef(err, "failed to make dir [%s]", dstDirPath)
|
return errors.WithMessagef(err, "failed to make dir [%s]", dstDirPath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user