Skip to content

Commit 4157818

Browse files
committed
Basic fixes for the update.
Signed-off-by: Johnathan Falk <johnathan.falk@gmail.com>
1 parent 982abaa commit 4157818

File tree

5 files changed

+17
-622
lines changed

5 files changed

+17
-622
lines changed

backends/aws_s3_backend.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ func withRequestLimiter(buffer chan bool) request.Option {
174174
func withComputeMD5HashHandler(ro *request.Request) {
175175
ro.Handlers.Build.PushBack(func(r *request.Request) {
176176
reader := r.GetBody()
177-
if reader == nil {
178-
return
179-
}
180177

181178
//nolint:gosec // MD5 not used cryptographically here
182179
md5Raw := md5.New()

backends/azure_backend.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (a *AzureBackend) Upload(ctx context.Context, vol *files.VolumeInfo) error
189189
case a.conf.MaxParallelUploadBuffer <- true:
190190
errg.Go(func() error {
191191
defer func() { <-a.conf.MaxParallelUploadBuffer }()
192-
_, err := blobURL.StageBlock(ctx, blockID, bytes.NewReader(buf[:n]), azblob.LeaseAccessConditions{}, md5sum[:])
192+
_, err := blobURL.StageBlock(ctx, blockID, bytes.NewReader(buf[:n]), azblob.LeaseAccessConditions{}, md5sum[:], azblob.ClientProvidedKeyOptions{})
193193
return err
194194
})
195195
}
@@ -213,7 +213,15 @@ func (a *AzureBackend) Upload(ctx context.Context, vol *files.VolumeInfo) error
213213

214214
// Finally, finalize the storage blob by giving Azure the block list order
215215
_, err = blobURL.CommitBlockList(
216-
ctx, blockIDs, azblob.BlobHTTPHeaders{ContentMD5: md5Raw}, azblob.Metadata{}, azblob.BlobAccessConditions{}, azblob.DefaultAccessTier, azblob.BlobTagsMap{},
216+
ctx,
217+
blockIDs,
218+
azblob.BlobHTTPHeaders{ContentMD5: md5Raw},
219+
azblob.Metadata{},
220+
azblob.BlobAccessConditions{},
221+
azblob.DefaultAccessTier,
222+
azblob.BlobTagsMap{},
223+
azblob.ClientProvidedKeyOptions{},
224+
azblob.ImmutabilityPolicyOptions{},
217225
)
218226
if err != nil {
219227
log.AppLogger.Debugf("azure backend: Error while finalizing volume %s - %v", vol.ObjectName, err)
@@ -236,7 +244,7 @@ func (a *AzureBackend) PreDownload(ctx context.Context, keys []string) error {
236244
// Download will download the requseted object which can be read from the returned io.ReadCloser
237245
func (a *AzureBackend) Download(ctx context.Context, name string) (io.ReadCloser, error) {
238246
blobURL := a.containerSvc.NewBlobURL(a.prefix + name)
239-
resp, err := blobURL.Download(ctx, 0, 0, azblob.BlobAccessConditions{}, false)
247+
resp, err := blobURL.Download(ctx, int64(0), int64(0), azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{})
240248
if err != nil {
241249
return nil, err
242250
}

backends/file_backend_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ package backends
2222

2323
import (
2424
"context"
25-
"io/ioutil"
2625
"os"
2726
"testing"
2827
)
@@ -78,7 +77,7 @@ func TestFileBackend(t *testing.T) {
7877
ctx, cancel := context.WithCancel(context.Background())
7978
defer cancel()
8079

81-
tempPath, err := ioutil.TempDir("", t.Name())
80+
tempPath, err := os.MkdirTemp("", t.Name())
8281
if err != nil {
8382
t.Fatalf("could not create temp dir: %v", err)
8483
}

go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ require (
3535
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
3636
github.com/Azure/go-autorest/logger v0.2.1 // indirect
3737
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
38-
github.com/davecgh/go-spew v1.1.1 // indirect
3938
github.com/dnaeon/go-vcr v1.2.0 // indirect
40-
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
4139
github.com/gofrs/uuid v4.3.1+incompatible // indirect
42-
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
40+
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
4341
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4442
github.com/golang/protobuf v1.5.2 // indirect
4543
github.com/google/go-cmp v0.5.9 // indirect
@@ -50,7 +48,6 @@ require (
5048
github.com/jmespath/go-jmespath v0.4.0 // indirect
5149
github.com/klauspost/compress v1.15.12 // indirect
5250
github.com/mattn/go-ieproxy v0.0.9 // indirect
53-
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5 // indirect
5451
github.com/spf13/pflag v1.0.5 // indirect
5552
go.opencensus.io v0.24.0 // indirect
5653
golang.org/x/net v0.2.0 // indirect

0 commit comments

Comments
 (0)