mirror of https://github.com/restic/restic.git
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
|
@ -6,6 +6,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -176,7 +177,9 @@ func (be *beSwift) Save(ctx context.Context, h restic.Handle, rd restic.RewindRe
|
||||||
encoding := "binary/octet-stream"
|
encoding := "binary/octet-stream"
|
||||||
|
|
||||||
debug.Log("PutObject(%v, %v, %v)", be.container, objName, encoding)
|
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)
|
debug.Log("%v, err %#v", objName, err)
|
||||||
|
|
||||||
return errors.Wrap(err, "client.PutObject")
|
return errors.Wrap(err, "client.PutObject")
|
||||||
|
|
Loading…
Reference in New Issue