diff --git a/src/restic/backend/rest/rest.go b/src/restic/backend/rest/rest.go index 6ed05965f..fe931a6b9 100644 --- a/src/restic/backend/rest/rest.go +++ b/src/restic/backend/rest/rest.go @@ -80,6 +80,10 @@ func (b *restBackend) Save(h restic.Handle, rd io.Reader) (err error) { return err } + // make sure that client.Post() cannot close the reader by wrapping it in + // backend.Closer, which has a noop method. + rd = backend.Closer{Reader: rd} + <-b.connChan resp, err := b.client.Post(restPath(b.url, h), "binary/octet-stream", rd) b.connChan <- struct{}{}