From 702fe8a6d2e64a5ea073d84b71e33e06b1e255d7 Mon Sep 17 00:00:00 2001 From: William Easton Date: Thu, 23 May 2024 23:06:48 -0500 Subject: [PATCH] small fix for custom domain endpoint url matchin --- x-pack/filebeat/input/awss3/input.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/filebeat/input/awss3/input.go b/x-pack/filebeat/input/awss3/input.go index 91e9d7f4772..0ca015b5c8b 100644 --- a/x-pack/filebeat/input/awss3/input.go +++ b/x-pack/filebeat/input/awss3/input.go @@ -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()) }