Skip to content

Commit

Permalink
simplify param checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nhulston committed Jan 14, 2025
1 parent 98a1df8 commit 32f31c7
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions contrib/aws/internal/span_pointers/span_pointers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,11 @@ func HandleS3Operation(in middleware.DeserializeInput, out middleware.Deserializ

// URL format: https://BUCKETNAME.s3.REGION.amazonaws.com/KEYNAME?x-id=OPERATIONNAME
key := strings.TrimPrefix(req.URL.Path, "/")
if key == "" {
log.Debug("Unable to create S3 span pointer because key could not be found.")
return
}

bucket := strings.Split(req.URL.Host, ".")[0]
if bucket == "" {
log.Debug("Unable to create S3 span pointer because bucket could not be found.")
return
}

// the AWS SDK sometimes wraps the eTag in quotes
etag := strings.Trim(res.Header.Get("ETag"), "\"")
if etag == "" {
log.Debug("Unable to create S3 span pointer because eTag could not be found.")
if key == "" || bucket == "" || etag == "" {
log.Debug("Unable to create S3 span pointer because key could not be found.")
return
}

Expand Down

0 comments on commit 32f31c7

Please sign in to comment.