Skip to content

Commit

Permalink
small fix for custom domain endpoint url matchin
Browse files Browse the repository at this point in the history
  • Loading branch information
strawgate committed May 24, 2024
1 parent 5346107 commit 702fe8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions x-pack/filebeat/input/awss3/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ func getRegionFromQueueURL(queueURL string, endpoint, defaultRegion string) (reg
// check for sqs queue url

// Parse a user-provided custom endpoint
if endpoint != "" && queueHostSplit[0] == "sqs" && len(queueHostSplit) >= 3 && len(endpointSplit) >= 3 {
if endpoint != "" && queueHostSplit[0] == "sqs" && len(queueHostSplit) == 3 && len(endpointSplit) == 3 {
// Check if everything after the second dot in the queue url matches everything after the second dot in the endpoint
endpointMatchesQueueUrl := strings.SplitN(u.Hostname(), ".", 2)[2] == strings.SplitN(e.Hostname(), ".", 2)[2]
endpointMatchesQueueUrl := strings.SplitN(u.Hostname(), ".", 3)[2] == strings.SplitN(e.Hostname(), ".", 3)[2]
if !endpointMatchesQueueUrl {
return "", fmt.Errorf("endpoint %q does not match queue_url %q", e.Hostname(), u.Hostname())
}
Expand Down

0 comments on commit 702fe8a

Please sign in to comment.