Skip to content

Commit 4fbc423

Browse files
committed
fix(cloudreve): set req.ContentLength
1 parent e2f4234 commit 4fbc423

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/cloudreve/util.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ func (d *Cloudreve) upRemote(ctx context.Context, stream model.FileStreamer, u U
208208
return err
209209
}
210210
req = req.WithContext(ctx)
211-
req.Header.Set("Content-Length", strconv.Itoa(int(byteSize)))
211+
req.ContentLength = byteSize
212+
// req.Header.Set("Content-Length", strconv.Itoa(int(byteSize)))
212213
req.Header.Set("Authorization", fmt.Sprint(credential))
213214
finish += byteSize
214215
res, err := base.HttpClient.Do(req)
@@ -247,7 +248,8 @@ func (d *Cloudreve) upOneDrive(ctx context.Context, stream model.FileStreamer, u
247248
return err
248249
}
249250
req = req.WithContext(ctx)
250-
req.Header.Set("Content-Length", strconv.Itoa(int(byteSize)))
251+
req.ContentLength = byteSize
252+
// req.Header.Set("Content-Length", strconv.Itoa(int(byteSize)))
251253
req.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", finish, finish+byteSize-1, stream.GetSize()))
252254
finish += byteSize
253255
res, err := base.HttpClient.Do(req)

0 commit comments

Comments
 (0)