Skip to content

Commit

Permalink
Merge pull request #111 from tombuildsstuff/bugfix/http-response-nil-…
Browse files Browse the repository at this point in the history
…checks

bugfix: nil checks on resp.Response
  • Loading branch information
manicminer authored Mar 22, 2024
2 parents 6dd97af + cb5cb8a commit a3d2864
Show file tree
Hide file tree
Showing 28 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/append_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c Client) AppendBlock(ctx context.Context, containerName, blobName string,
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.BlobAppendOffset = resp.Header.Get("x-ms-blob-append-offset")
result.ContentMD5 = resp.Header.Get("Content-MD5")
result.ETag = resp.Header.Get("ETag")
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (c Client) Copy(ctx context.Context, containerName, blobName string, input
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.CopyID = resp.Header.Get("x-ms-copy-id")
result.CopyStatus = resp.Header.Get("x-ms-copy-status")
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/get_block_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (c Client) GetBlockList(ctx context.Context, containerName, blobName string
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.ContentType = resp.Header.Get("Content-Type")
result.ETag = resp.Header.Get("ETag")

Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/get_page_ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (c Client) GetPageRanges(ctx context.Context, containerName, blobName strin
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.ContentType = resp.Header.Get("Content-Type")
result.ETag = resp.Header.Get("ETag")

Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/lease_acquire.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (c Client) AcquireLease(ctx context.Context, containerName, blobName string
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.LeaseID = resp.Header.Get("x-ms-lease-id")
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/lease_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c Client) ChangeLease(ctx context.Context, containerName, blobName string,
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.LeaseID = resp.Header.Get("x-ms-lease-id")
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/properties_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (c Client) GetProperties(ctx context.Context, containerName, blobName strin
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.AccessTier = AccessTier(resp.Header.Get("x-ms-access-tier"))
result.AccessTierChangeTime = resp.Header.Get("x-ms-access-tier-change-time")
result.ArchiveStatus = ArchiveStatus(resp.Header.Get("x-ms-archive-status"))
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/put_block_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (c Client) PutBlockList(ctx context.Context, containerName, blobName string
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.ContentMD5 = resp.Header.Get("Content-MD5")
result.ETag = resp.Header.Get("ETag")
result.LastModified = resp.Header.Get("Last-Modified")
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/put_block_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (c Client) PutBlockFromURL(ctx context.Context, containerName, blobName str
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.ContentMD5 = resp.Header.Get("Content-MD5")
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/put_page_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (c Client) PutPageUpdate(ctx context.Context, containerName, blobName strin
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.BlobSequenceNumber = resp.Header.Get("x-ms-blob-sequence-number")
result.ContentMD5 = resp.Header.Get("Content-MD5")
result.LastModified = resp.Header.Get("Last-Modified")
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (c Client) Snapshot(ctx context.Context, containerName, blobName string, in
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.ETag = resp.Header.Get("ETag")
result.SnapshotDateTime = resp.Header.Get("x-ms-snapshot")
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/blobs/snapshot_get_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (c Client) GetSnapshotProperties(ctx context.Context, containerName, blobNa
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.AccessTier = AccessTier(resp.Header.Get("x-ms-access-tier"))
result.AccessTierChangeTime = resp.Header.Get("x-ms-access-tier-change-time")
result.ArchiveStatus = ArchiveStatus(resp.Header.Get("x-ms-archive-status"))
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/containers/get_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (c Client) GetProperties(ctx context.Context, containerName string, input G
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.DefaultEncryptionScope = resp.Header.Get("x-ms-default-encryption-scope")
result.LeaseStatus = LeaseStatus(resp.Header.Get("x-ms-lease-status"))
result.LeaseState = LeaseState(resp.Header.Get("x-ms-lease-state"))
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/containers/lease_acquire.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c Client) AcquireLease(ctx context.Context, containerName string, input Ac
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.LeaseID = resp.Header.Get("x-ms-lease-id")
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/containers/lease_break.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (c Client) BreakLease(ctx context.Context, containerName string, input Brea
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
if leaseTimeRaw := resp.Header.Get("x-ms-lease-time"); leaseTimeRaw != "" {
if leaseTime, err := strconv.Atoi(leaseTimeRaw); err == nil {
result.LeaseTime = leaseTime
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/blob/containers/lease_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c Client) ChangeLease(ctx context.Context, containerName string, input Cha
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.LeaseID = resp.Header.Get("x-ms-lease-id")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (c Client) GetProperties(ctx context.Context, fileSystemName string) (resul
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
propertiesRaw := resp.Header.Get("x-ms-properties")
var properties *map[string]string
properties, err = parseProperties(propertiesRaw)
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/datalakestore/paths/properties_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c Client) GetProperties(ctx context.Context, fileSystemName string, path s
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.ResourceType = PathResource(resp.Header.Get("x-ms-resource-type"))
result.ETag = resp.Header.Get("ETag")

Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/directories/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c Client) Get(ctx context.Context, shareName, path string) (result GetResp
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.DirectoryMetaDataEncrypted = strings.EqualFold(resp.Header.Get("x-ms-server-encrypted"), "true")
result.MetaData = metadata.ParseFromHeaders(resp.Header)
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/directories/metadata_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (c Client) GetMetaData(ctx context.Context, shareName, path string) (result
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.MetaData = metadata.ParseFromHeaders(resp.Header)
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/files/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (c Client) Copy(ctx context.Context, shareName, path, fileName string, inpu
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.CopyID = resp.Header.Get("x-ms-copy-id")
result.CopySuccess = resp.Header.Get("x-ms-copy-status")
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/files/metadata_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c Client) GetMetaData(ctx context.Context, shareName, path, fileName strin
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.MetaData = metadata.ParseFromHeaders(resp.Header)
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/files/properties_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (c Client) GetProperties(ctx context.Context, shareName, path, fileName str
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.CacheControl = resp.Header.Get("Cache-Control")
result.ContentDisposition = resp.Header.Get("Content-Disposition")
result.ContentEncoding = resp.Header.Get("Content-Encoding")
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/shares/metadata_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (c Client) GetMetaData(ctx context.Context, shareName string) (result GetMe
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.MetaData = metadata.ParseFromHeaders(resp.Header)
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/shares/properties_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c Client) GetProperties(ctx context.Context, shareName string) (result Get
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.MetaData = metadata.ParseFromHeaders(resp.Header)

quotaRaw := resp.Header.Get("x-ms-share-quota")
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/shares/snapshot_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (c Client) CreateSnapshot(ctx context.Context, shareName string, input Crea
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.SnapshotDateTime = resp.Header.Get("x-ms-snapshot")
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/file/shares/snapshot_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (c Client) GetSnapshot(ctx context.Context, shareName string, input GetSnap
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.MetaData = metadata.ParseFromHeaders(resp.Header)
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/2023-11-03/queue/queues/metadata_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (c Client) GetMetaData(ctx context.Context, queueName string) (result GetMe
if resp != nil {
result.HttpResponse = resp.Response

if resp.Header != nil {
if resp.Response != nil && resp.Header != nil {
result.MetaData = metadata.ParseFromHeaders(resp.Header)
}
}
Expand Down

0 comments on commit a3d2864

Please sign in to comment.