mirror of https://github.com/Xhofe/alist
But we do not recommend not adding the content-length header when putting filespull/5184/head
parent
3c66db9845
commit
b604e21c69
|
@ -26,6 +26,16 @@ type FileStream struct {
|
|||
peekBuff *bytes.Reader
|
||||
}
|
||||
|
||||
func (f *FileStream) GetSize() int64 {
|
||||
if f.tmpFile != nil {
|
||||
info, err := f.tmpFile.Stat()
|
||||
if err == nil {
|
||||
return info.Size()
|
||||
}
|
||||
}
|
||||
return f.Obj.GetSize()
|
||||
}
|
||||
|
||||
func (f *FileStream) GetMimetype() string {
|
||||
return f.Mimetype
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ func CreateTempFile(r io.Reader, size int64) (*os.File, error) {
|
|||
_ = os.Remove(f.Name())
|
||||
return nil, errs.NewErr(err, "CreateTempFile failed")
|
||||
}
|
||||
if size != 0 && readBytes != size {
|
||||
if size > 0 && readBytes != size {
|
||||
_ = os.Remove(f.Name())
|
||||
return nil, errs.NewErr(err, "CreateTempFile failed, incoming stream actual size= %d, expect = %d ", readBytes, size)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue