From eaec804bf780cd5e48d737798d3447ed52ca4886 Mon Sep 17 00:00:00 2001 From: Urvi Date: Mon, 13 May 2024 17:37:14 -0700 Subject: [PATCH 1/2] support/datastore: Fix putFile() to upload to the bucket --- support/datastore/gcs_datastore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/datastore/gcs_datastore.go b/support/datastore/gcs_datastore.go index c8c22fd57e..606f76bbb0 100644 --- a/support/datastore/gcs_datastore.go +++ b/support/datastore/gcs_datastore.go @@ -162,7 +162,7 @@ func (b GCSDataStore) putFile(ctx context.Context, filePath string, in io.Writer w.SendCRC32C = true // we must set CRC32C before invoking w.Write() for the first time w.CRC32C = crc32.Checksum(buf.Bytes(), crc32.MakeTable(crc32.Castagnoli)) - if _, err := in.WriteTo(buf); err != nil { + if _, err := in.WriteTo(w); err != nil { return errors.Wrapf(err, "failed to put file: %s", filePath) } return w.Close() From 6c538af46312227ce94bfd62d1b7fcd5f7a39c0f Mon Sep 17 00:00:00 2001 From: urvisavla Date: Tue, 14 May 2024 09:45:10 -0700 Subject: [PATCH 2/2] Update support/datastore/gcs_datastore.go Co-authored-by: tamirms --- support/datastore/gcs_datastore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/datastore/gcs_datastore.go b/support/datastore/gcs_datastore.go index 606f76bbb0..76de421566 100644 --- a/support/datastore/gcs_datastore.go +++ b/support/datastore/gcs_datastore.go @@ -162,7 +162,7 @@ func (b GCSDataStore) putFile(ctx context.Context, filePath string, in io.Writer w.SendCRC32C = true // we must set CRC32C before invoking w.Write() for the first time w.CRC32C = crc32.Checksum(buf.Bytes(), crc32.MakeTable(crc32.Castagnoli)) - if _, err := in.WriteTo(w); err != nil { + if _, err := io.Copy(w, buf); err != nil { return errors.Wrapf(err, "failed to put file: %s", filePath) } return w.Close()