mirror of
https://github.com/AlistGo/alist.git
synced 2025-04-21 20:18:47 +08:00
chore: close stream after put
This commit is contained in:
parent
ffa0bc294a
commit
3a1fcbef1c
@ -3,6 +3,7 @@ package operations
|
||||
import (
|
||||
"context"
|
||||
"github.com/alist-org/alist/v3/internal/errs"
|
||||
log "github.com/sirupsen/logrus"
|
||||
stdpath "path"
|
||||
"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 {
|
||||
defer func() {
|
||||
if err := file.Close(); err != nil {
|
||||
log.Errorf("failed to close file streamer, %v", err)
|
||||
}
|
||||
}()
|
||||
err := MakeDir(ctx, account, dstDirPath)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "failed to make dir [%s]", dstDirPath)
|
||||
|
Loading…
x
Reference in New Issue
Block a user