Merge pull request #4084 from ekarlso/azure-stat-fix

fix: Make create not error out when ContainerNotFound
This commit is contained in:
Michael Eischer 2022-12-13 22:49:05 +01:00 committed by GitHub
commit 1c071a462e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -130,6 +130,8 @@ func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (*Backend, er
return nil, errors.Wrap(err, "open")
}
_, err = be.container.GetProperties(ctx, &azContainer.GetPropertiesOptions{})
if err != nil && bloberror.HasCode(err, bloberror.ContainerNotFound) {
_, err = be.container.Create(ctx, &azContainer.CreateOptions{})
@ -363,7 +365,7 @@ func (be *Backend) Remove(ctx context.Context, h restic.Handle) error {
debug.Log("Remove(%v) at %v -> err %v", h, objName, err)
if bloberror.HasCode(err, bloberror.BlobNotFound) {
if be.IsNotExist(err) {
return nil
}