Skip to content

Commit

Permalink
Error on Azure async copy (#1738)
Browse files Browse the repository at this point in the history
  • Loading branch information
guy-har authored Apr 8, 2021
1 parent 65b180c commit 1a24fb1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
env:
GOLANGCI_LINT_FLAGS: --out-format github-actions
- name: gitLeaks
uses: zricethezav/gitleaks-action@v1.3.0
uses: zricethezav/gitleaks-action@v1.5.0

test:
name: Run Test Suite
Expand Down
13 changes: 11 additions & 2 deletions pkg/block/azure/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

var (
ErrNotImplemented = errors.New("not implemented")
ErrAsyncCopy = errors.New("asynchronous copy not supported")
)

const (
Expand Down Expand Up @@ -303,8 +304,16 @@ func (a *Adapter) Copy(ctx context.Context, sourceObj, destinationObj block.Obje

destinationContainer := a.getContainerURL(qualifiedDestinationKey.ContainerURL)
destinationURL := destinationContainer.NewBlobURL(qualifiedDestinationKey.BlobURL)
_, err = destinationURL.StartCopyFromURL(ctx, sourceURL.URL(), azblob.Metadata{}, azblob.ModifiedAccessConditions{}, azblob.BlobAccessConditions{}, azblob.AccessTierNone, azblob.BlobTagsMap{})
return err
resp, err := destinationURL.StartCopyFromURL(ctx, sourceURL.URL(), azblob.Metadata{}, azblob.ModifiedAccessConditions{}, azblob.BlobAccessConditions{}, azblob.AccessTierNone, azblob.BlobTagsMap{})
if err != nil {
return err
}
// validate copy is not asynchronous
copyStatus := resp.CopyStatus()
if copyStatus == "pending" {
return ErrAsyncCopy
}
return nil
}

func (a *Adapter) CreateMultiPartUpload(ctx context.Context, obj block.ObjectPointer, _ *http.Request, _ block.CreateMultiPartUploadOpts) (string, error) {
Expand Down

0 comments on commit 1a24fb1

Please sign in to comment.