mirror of https://github.com/perkeep/perkeep.git
whoops, was using offset wrong in filewriter
This commit is contained in:
parent
2116273f64
commit
2c66ab38ad
|
@ -38,13 +38,11 @@ func WriteFileFromReader(bs blobserver.Storage, filename string, r io.Reader) (*
|
||||||
// Naive for now. Just in 1MB chunks.
|
// Naive for now. Just in 1MB chunks.
|
||||||
// TODO: rolling hash and hash trees.
|
// TODO: rolling hash and hash trees.
|
||||||
|
|
||||||
parts := []ContentPart{}
|
parts, size := []ContentPart{}, int64(0)
|
||||||
size, offset := int64(0), int64(0)
|
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
for {
|
for {
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
offset = size
|
|
||||||
|
|
||||||
n, err := io.Copy(buf, io.LimitReader(r, 1<<20))
|
n, err := io.Copy(buf, io.LimitReader(r, 1<<20))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -76,7 +74,7 @@ func WriteFileFromReader(bs blobserver.Storage, filename string, r io.Reader) (*
|
||||||
BlobRefString: br.String(),
|
BlobRefString: br.String(),
|
||||||
BlobRef: br,
|
BlobRef: br,
|
||||||
Size: uint64(n),
|
Size: uint64(n),
|
||||||
Offset: uint64(offset),
|
Offset: 0, // into BlobRef to read from (not of dest)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue