Skip to content

Commit

Permalink
fix: temp file not close and incorrect WebPutAsTask
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Aug 28, 2023
1 parent 6c4736f commit ce10c9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions internal/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/handles/fsup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ce10c9f

Please sign in to comment.