2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 23:06:32 +00:00

rest backend: Do not close the reader

Closes #747
This commit is contained in:
Alexander Neumann 2017-01-25 17:07:58 +01:00
parent 925a3cfad7
commit e8995b85b8

View File

@ -80,6 +80,10 @@ func (b *restBackend) Save(h restic.Handle, rd io.Reader) (err error) {
return err 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 <-b.connChan
resp, err := b.client.Post(restPath(b.url, h), "binary/octet-stream", rd) resp, err := b.client.Post(restPath(b.url, h), "binary/octet-stream", rd)
b.connChan <- struct{}{} b.connChan <- struct{}{}