fix: temp file not close and incorrect WebPutAsTask
This commit is contained in:
parent
6c4736fc8f
commit
ce10c9f120
@ -5,12 +5,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/alist-org/alist/v3/internal/errs"
|
"github.com/alist-org/alist/v3/internal/errs"
|
||||||
"github.com/alist-org/alist/v3/internal/model"
|
"github.com/alist-org/alist/v3/internal/model"
|
||||||
"github.com/alist-org/alist/v3/pkg/http_range"
|
"github.com/alist-org/alist/v3/pkg/http_range"
|
||||||
"github.com/alist-org/alist/v3/pkg/utils"
|
"github.com/alist-org/alist/v3/pkg/utils"
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileStream struct {
|
type FileStream struct {
|
||||||
@ -66,6 +67,7 @@ func (f *FileStream) CacheFullInTempFile() (model.File, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
f.Add(tmpF)
|
||||||
f.tmpFile = tmpF
|
f.tmpFile = tmpF
|
||||||
f.Reader = tmpF
|
f.Reader = tmpF
|
||||||
return f.tmpFile, nil
|
return f.tmpFile, nil
|
||||||
@ -220,6 +222,7 @@ func (ss *SeekableStream) CacheFullInTempFile() (model.File, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
ss.Add(tmpF)
|
||||||
ss.tmpFile = tmpF
|
ss.tmpFile = tmpF
|
||||||
ss.Reader = tmpF
|
ss.Reader = tmpF
|
||||||
return ss.tmpFile, nil
|
return ss.tmpFile, nil
|
||||||
|
@ -111,7 +111,7 @@ func FsForm(c *gin.Context) {
|
|||||||
},
|
},
|
||||||
Reader: f,
|
Reader: f,
|
||||||
Mimetype: file.Header.Get("Content-Type"),
|
Mimetype: file.Header.Get("Content-Type"),
|
||||||
WebPutAsTask: false,
|
WebPutAsTask: asTask,
|
||||||
}
|
}
|
||||||
ss, err := stream.NewSeekableStream(s, nil)
|
ss, err := stream.NewSeekableStream(s, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user