Merge pull request #702 from LLluma/bug_sqs_url_china_region

[BUG] Fix AWS SQS base domain parsing for China region
This commit is contained in:
Josh Baker 2023-11-20 11:27:32 -07:00 committed by GitHub
commit ee61cd11c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -132,13 +132,13 @@ func newSQSConn(ep Endpoint) *SQSConn {
func probeSQS(s string) bool { func probeSQS(s string) bool {
// https://sqs.eu-central-1.amazonaws.com/123456789/myqueue // https://sqs.eu-central-1.amazonaws.com/123456789/myqueue
return strings.HasPrefix(s, "https://sqs.") && return strings.HasPrefix(s, "https://sqs.") &&
strings.Contains(s, ".amazonaws.com/") strings.Contains(s, ".amazonaws.com")
} }
func sqsRegionFromPlainURL(s string) string { func sqsRegionFromPlainURL(s string) string {
parts := strings.Split(s, "https://sqs.") parts := strings.Split(s, "https://sqs.")
if len(parts) > 1 { if len(parts) > 1 {
parts = strings.Split(parts[1], ".amazonaws.com/") parts = strings.Split(parts[1], ".amazonaws.com")
if len(parts) > 1 { if len(parts) > 1 {
return parts[0] return parts[0]
} }