@@ -373,10 +373,6 @@ func (c *EOSHTTPClient) PUTFile(ctx context.Context, remoteuser string, auth eos
373
373
base .RawQuery = queryValues .Encode ()
374
374
finalurl := base .String ()
375
375
376
- if err != nil {
377
- log .Error ().Str ("func" , "PUTFile" ).Str ("url" , finalurl ).Str ("err" , err .Error ()).Msg ("can't create request" )
378
- return err
379
- }
380
376
req , err := http .NewRequestWithContext (ctx , http .MethodPut , finalurl , nil )
381
377
if err != nil {
382
378
log .Error ().Str ("func" , "PUTFile" ).Str ("url" , finalurl ).Str ("err" , err .Error ()).Msg ("can't create request" )
@@ -424,15 +420,8 @@ func (c *EOSHTTPClient) PUTFile(ctx context.Context, remoteuser string, auth eos
424
420
}
425
421
if length >= 0 {
426
422
log .Debug ().Str ("func" , "PUTFile" ).Int64 ("Content-Length" , length ).Msg ("setting header" )
427
- req .Header .Set ("Content-Length" , strconv .FormatInt (length , 10 ))
428
- }
429
- if err != nil {
430
- log .Error ().Str ("func" , "PUTFile" ).Str ("url" , loc .String ()).Str ("err" , err .Error ()).Msg ("can't create redirected request" )
431
- return err
432
- }
433
- if length >= 0 {
434
- log .Debug ().Str ("func" , "PUTFile" ).Int64 ("Content-Length" , length ).Msg ("setting header" )
435
- req .Header .Set ("Content-Length" , strconv .FormatInt (length , 10 ))
423
+ req .ContentLength = length
424
+ req .Header .Set ("Content-Length" , fmt .Sprintf ("%d" , length ))
436
425
}
437
426
438
427
log .Debug ().Str ("func" , "PUTFile" ).Str ("location" , loc .String ()).Msg ("redirection" )
0 commit comments