forked from TrueCloudLab/restic
swift: explicitly pass upload size to library
This allows properly setting the content-length which could help the server-side to detect incomplete uploads.
This commit is contained in:
parent
dca9b6f5db
commit
4526d5d197
1 changed files with 4 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -176,7 +177,9 @@ func (be *beSwift) Save(ctx context.Context, h restic.Handle, rd restic.RewindRe
|
|||
encoding := "binary/octet-stream"
|
||||
|
||||
debug.Log("PutObject(%v, %v, %v)", be.container, objName, encoding)
|
||||
_, err := be.conn.ObjectPut(be.container, objName, rd, true, "", encoding, nil)
|
||||
hdr := swift.Headers{"Content-Length": strconv.FormatInt(rd.Length(), 10)}
|
||||
_, err := be.conn.ObjectPut(be.container, objName, rd, true, "", encoding, hdr)
|
||||
// swift does not return the upload length
|
||||
debug.Log("%v, err %#v", objName, err)
|
||||
|
||||
return errors.Wrap(err, "client.PutObject")
|
||||
|
|
Loading…
Reference in a new issue