feat: upload progress recovery (#4987)
* feat(189pc):upload progress recovery * fix:some err * feat(baidu_netdisk,baidu_photo):upload progress recovery * feat(mopan):upload progress recovery * feat(baidu_netdisk):custom upload api
This commit is contained in:
@ -52,14 +52,15 @@ type limitWriter struct {
|
||||
}
|
||||
|
||||
func (l *limitWriter) Write(p []byte) (n int, err error) {
|
||||
lp := len(p)
|
||||
if l.limit > 0 {
|
||||
if int64(len(p)) > l.limit {
|
||||
if int64(lp) > l.limit {
|
||||
p = p[:l.limit]
|
||||
}
|
||||
l.limit -= int64(len(p))
|
||||
_, err = l.w.Write(p)
|
||||
}
|
||||
return len(p), err
|
||||
return lp, err
|
||||
}
|
||||
|
||||
func LimitWriter(w io.Writer, limit int64) io.Writer {
|
||||
|
Reference in New Issue
Block a user