You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeFileStreamstruct {
Ctx context.Context
model.Obj
io.ReaderMimetypestringWebPutAsTaskboolExist model.Obj//the file existed in the destination, we can reuse some info since we wil overwrite it
utils.CloserstmpFile*os.File//if present, tmpFile has full content, it will be deleted at lastpeekBuff*bytes.Reader
}
func (f*FileStream) GetSize() int64 {
iff.tmpFile!=nil {
info, err:=f.tmpFile.Stat()
iferr==nil {
returninfo.Size()
}
}
returnf.Obj.GetSize()
}
我愿意提一个PR来修改这个问题
Reproduction / 复现链接
无
Config / 配置
无
Logs / 日志
ERRO[2023-09-04 08:52:19] PUT /dav/quark/photos/2023/09/02/20230902012905_20230902_132905.JPG %!w(<nil>); CreateTempFile failed, incoming stream actual size= 2786239, expec
t = -1 github.com/alist-org/alist/v3/internal/op.Put
/app/internal/op/fs.go:566
The text was updated successfully, but these errors were encountered:
Please make sure of the following things
I have read the documentation.
我已经阅读了文档。
I'm sure there are no duplicate issues or discussions.
我确定没有重复的issue或讨论。
I'm sure it's due to
AList
and not something else(such as Network ,Dependencies
orOperational
).我确定是
AList
的问题,而不是其他原因(例如网络,依赖
或操作
)。I'm sure this issue is not fixed in the latest version.
我确定这个问题在最新版本中没有被修复。
AList Version / AList 版本
v3.27.0
Driver used / 使用的存储驱动
any
Describe the bug / 问题描述
使用webdav上传文件时,当content的内容长度未知时,会使用
chunked
模式来上传,这种情况下header中不会填写Content-Length,但在alist的http处理中(不确定是Gin还是net.http的行为)会把http.Request.ContentLength
置为-1.于是在这段代码中
pkg/utils/file.go
:size
的最终实际取值是http.Request.ContentLength
,即-1,导致返回了错误.我建议将
size != 0
修改为size > 0
,以支持chunked模式同时建议
internal/stream/stream.go
中的FileStream
的GetSize()
方法,如果已经存了临时文件就先取临时文件的长度,以减少以上场景取到无效的Size.像这样:我愿意提一个PR来修改这个问题
Reproduction / 复现链接
无
Config / 配置
无
Logs / 日志
The text was updated successfully, but these errors were encountered: