fix: temp file not close and incorrect WebPutAsTask

This commit is contained in:
Andy Hsu 2023-08-28 18:18:02 +08:00
parent 6c4736fc8f
commit ce10c9f120
2 changed files with 6 additions and 3 deletions

View File

@ -5,12 +5,13 @@ import (
"context"
"errors"
"fmt"
"io"
"os"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/pkg/http_range"
"github.com/alist-org/alist/v3/pkg/utils"
"io"
"os"
)
type FileStream struct {
@ -66,6 +67,7 @@ func (f *FileStream) CacheFullInTempFile() (model.File, error) {
if err != nil {
return nil, err
}
f.Add(tmpF)
f.tmpFile = tmpF
f.Reader = tmpF
return f.tmpFile, nil
@ -220,6 +222,7 @@ func (ss *SeekableStream) CacheFullInTempFile() (model.File, error) {
if err != nil {
return nil, err
}
ss.Add(tmpF)
ss.tmpFile = tmpF
ss.Reader = tmpF
return ss.tmpFile, nil

View File

@ -111,7 +111,7 @@ func FsForm(c *gin.Context) {
},
Reader: f,
Mimetype: file.Header.Get("Content-Type"),
WebPutAsTask: false,
WebPutAsTask: asTask,
}
ss, err := stream.NewSeekableStream(s, nil)
if err != nil {