@@ -175,9 +175,9 @@ func (d *Quark) Put(ctx context.Context, dstDir model.Obj, stream model.FileStre
175
175
var bytes []byte
176
176
md5s := make ([]string , 0 )
177
177
defaultBytes := make ([]byte , partSize )
178
- left := stream .GetSize ()
178
+ total := stream .GetSize ()
179
+ left := total
179
180
partNumber := 1
180
- sizeDivide100 := stream .GetSize () / 100
181
181
for left > 0 {
182
182
if utils .IsCanceled (ctx ) {
183
183
return ctx .Err ()
@@ -191,7 +191,7 @@ func (d *Quark) Put(ctx context.Context, dstDir model.Obj, stream model.FileStre
191
191
if err != nil {
192
192
return err
193
193
}
194
- left -= int64 (partSize )
194
+ left -= int64 (len ( bytes ) )
195
195
log .Debugf ("left: %d" , left )
196
196
m , err := d .upPart (ctx , pre , stream .GetMimetype (), partNumber , bytes )
197
197
//m, err := driver.UpPart(pre, file.GetMIMEType(), partNumber, bytes, account, md5Str, sha1Str)
@@ -203,7 +203,7 @@ func (d *Quark) Put(ctx context.Context, dstDir model.Obj, stream model.FileStre
203
203
}
204
204
md5s = append (md5s , m )
205
205
partNumber ++
206
- up (100 - int ( left / sizeDivide100 ))
206
+ up (int ( 100 * ( total - left ) / total ))
207
207
}
208
208
err = d .upCommit (pre , md5s )
209
209
if err != nil {
0 commit comments