Skip to content

Commit 296701c

Browse files
committed
fix(onedrive): set req.ContentLength
1 parent 370a6c1 commit 296701c

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

drivers/cloudreve/util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ func (d *Cloudreve) upOneDrive(ctx context.Context, stream model.FileStreamer, u
247247
return err
248248
}
249249
req = req.WithContext(ctx)
250+
req.ContentLength = byteSize
250251
req.Header.Set("Content-Length", strconv.Itoa(int(byteSize)))
251252
req.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", finish, finish+byteSize-1, stream.GetSize()))
252253
finish += byteSize

drivers/onedrive/util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ func (d *Onedrive) upBig(ctx context.Context, dstDir model.Obj, stream model.Fil
226226
return err
227227
}
228228
req = req.WithContext(ctx)
229+
req.ContentLength = byteSize
229230
req.Header.Set("Content-Length", strconv.Itoa(int(byteSize)))
230231
req.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", finish, finish+byteSize-1, stream.GetSize()))
231232
finish += byteSize

drivers/onedrive_app/util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ func (d *OnedriveAPP) upBig(ctx context.Context, dstDir model.Obj, stream model.
176176
return err
177177
}
178178
req = req.WithContext(ctx)
179+
req.ContentLength = byteSize
179180
req.Header.Set("Content-Length", strconv.Itoa(int(byteSize)))
180181
req.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", finish, finish+byteSize-1, stream.GetSize()))
181182
finish += byteSize

0 commit comments

Comments
 (0)