From af1fa641501124685d23fee220a89c9b6ad9ed7e Mon Sep 17 00:00:00 2001 From: Ryan Koval Date: Fri, 9 Aug 2024 01:13:12 -0500 Subject: [PATCH] fixed region query param not being appended always (saves a redirect) --- info.plist | 2 +- searchers/.snapshots/TestCodePipelinePipelinesSearcher | 6 +++--- util/aws_tools.go | 8 ++++++-- workflow/.snapshots/TestRun-cloudformation_ | 2 +- workflow/.snapshots/TestRun-codepipeline_pipelines_ | 6 +++--- .../TestRun-codepipeline_pipelines_pipeline-name-1 | 2 +- workflow/.snapshots/TestRun-ec2_ | 4 ++-- workflow/.snapshots/TestRun-ec2_inst | 2 +- workflow/.snapshots/TestRun-ec2_instances | 2 +- workflow/.snapshots/TestRun-elasticbeanstalk_ | 2 +- 10 files changed, 20 insertions(+), 16 deletions(-) diff --git a/info.plist b/info.plist index 12af8c01..9407497a 100644 --- a/info.plist +++ b/info.plist @@ -294,7 +294,7 @@ A powerful workflow for quickly opening up AWS Console Services in your browser or searching for entities within them. -Supports Alfred 3 and 4 +Supports Alfred 3, 4, and 5 Please see https://github.com/rkoval/alfred-aws-console-services-workflow for more details uidata diff --git a/searchers/.snapshots/TestCodePipelinePipelinesSearcher b/searchers/.snapshots/TestCodePipelinePipelinesSearcher index 062e27d3..b532fbe5 100644 --- a/searchers/.snapshots/TestCodePipelinePipelinesSearcher +++ b/searchers/.snapshots/TestCodePipelinePipelinesSearcher @@ -6,7 +6,7 @@ uid: (*string)(), autocomplete: (*string)((len=16) "pipeline-name-1 "), arg: ([]string) (len=1) { - (string) (len=94) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-1/view" + (string) (len=111) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-1/view?region=us-west-2" }, valid: (bool) true, file: (bool) false, @@ -42,7 +42,7 @@ uid: (*string)(), autocomplete: (*string)((len=16) "pipeline-name-2 "), arg: ([]string) (len=1) { - (string) (len=94) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-2/view" + (string) (len=111) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-2/view?region=us-west-2" }, valid: (bool) true, file: (bool) false, @@ -78,7 +78,7 @@ uid: (*string)(), autocomplete: (*string)((len=16) "pipeline-name-3 "), arg: ([]string) (len=1) { - (string) (len=94) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-3/view" + (string) (len=111) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-3/view?region=us-west-2" }, valid: (bool) true, file: (bool) false, diff --git a/util/aws_tools.go b/util/aws_tools.go index b452c487..a1eff3c4 100644 --- a/util/aws_tools.go +++ b/util/aws_tools.go @@ -38,8 +38,12 @@ func ConstructAWSConsoleUrl(path, region string) string { urlBuilder.WriteString(AWSConsoleDomain) - if region != "" { - urlBuilder.WriteString(strings.Replace(path, "#", "?region="+region+"#", 1)) + if region != "" && !strings.Contains(path, "region=") { + if strings.Contains(path, "#") { + urlBuilder.WriteString(strings.Replace(path, "#", "?region="+region+"#", 1)) + } else { + urlBuilder.WriteString(path + "?region=" + region) + } } else { urlBuilder.WriteString(path) } diff --git a/workflow/.snapshots/TestRun-cloudformation_ b/workflow/.snapshots/TestRun-cloudformation_ index 935d3ee4..c1d05aa5 100644 --- a/workflow/.snapshots/TestRun-cloudformation_ +++ b/workflow/.snapshots/TestRun-cloudformation_ @@ -78,7 +78,7 @@ uid: (*string)((len=8) "designer"), autocomplete: (*string)((len=24) "cloudformation designer "), arg: ([]string) (len=1) { - (string) (len=69) "https://us-west-2.console.aws.amazon.com/cloudformation/designer/home" + (string) (len=86) "https://us-west-2.console.aws.amazon.com/cloudformation/designer/home?region=us-west-2" }, valid: (bool) true, file: (bool) false, diff --git a/workflow/.snapshots/TestRun-codepipeline_pipelines_ b/workflow/.snapshots/TestRun-codepipeline_pipelines_ index b18fb64c..efdddf46 100644 --- a/workflow/.snapshots/TestRun-codepipeline_pipelines_ +++ b/workflow/.snapshots/TestRun-codepipeline_pipelines_ @@ -6,7 +6,7 @@ uid: (*string)(), autocomplete: (*string)((len=39) "codepipeline pipelines pipeline-name-1 "), arg: ([]string) (len=1) { - (string) (len=94) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-1/view" + (string) (len=111) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-1/view?region=us-west-2" }, valid: (bool) true, file: (bool) false, @@ -42,7 +42,7 @@ uid: (*string)(), autocomplete: (*string)((len=39) "codepipeline pipelines pipeline-name-2 "), arg: ([]string) (len=1) { - (string) (len=94) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-2/view" + (string) (len=111) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-2/view?region=us-west-2" }, valid: (bool) true, file: (bool) false, @@ -78,7 +78,7 @@ uid: (*string)(), autocomplete: (*string)((len=39) "codepipeline pipelines pipeline-name-3 "), arg: ([]string) (len=1) { - (string) (len=94) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-3/view" + (string) (len=111) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-3/view?region=us-west-2" }, valid: (bool) true, file: (bool) false, diff --git a/workflow/.snapshots/TestRun-codepipeline_pipelines_pipeline-name-1 b/workflow/.snapshots/TestRun-codepipeline_pipelines_pipeline-name-1 index ac1a155d..393a860c 100644 --- a/workflow/.snapshots/TestRun-codepipeline_pipelines_pipeline-name-1 +++ b/workflow/.snapshots/TestRun-codepipeline_pipelines_pipeline-name-1 @@ -6,7 +6,7 @@ uid: (*string)(), autocomplete: (*string)((len=39) "codepipeline pipelines pipeline-name-1 "), arg: ([]string) (len=1) { - (string) (len=94) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-1/view" + (string) (len=111) "https://us-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/pipeline-name-1/view?region=us-west-2" }, valid: (bool) true, file: (bool) false, diff --git a/workflow/.snapshots/TestRun-ec2_ b/workflow/.snapshots/TestRun-ec2_ index ccf349c8..542fdb69 100644 --- a/workflow/.snapshots/TestRun-ec2_ +++ b/workflow/.snapshots/TestRun-ec2_ @@ -258,7 +258,7 @@ uid: (*string)((len=12) "spotrequests"), autocomplete: (*string)((len=17) "ec2 spotrequests "), arg: ([]string) (len=1) { - (string) (len=46) "https://us-west-2.console.aws.amazon.com/ec2sp" + (string) (len=63) "https://us-west-2.console.aws.amazon.com/ec2sp?region=us-west-2" }, valid: (bool) true, file: (bool) false, @@ -402,7 +402,7 @@ uid: (*string)((len=18) "scheduledinstances"), autocomplete: (*string)((len=23) "ec2 scheduledinstances "), arg: ([]string) (len=1) { - (string) (len=57) "https://us-west-2.console.aws.amazon.com/ec2sp/v2/si/home" + (string) (len=74) "https://us-west-2.console.aws.amazon.com/ec2sp/v2/si/home?region=us-west-2" }, valid: (bool) true, file: (bool) false, diff --git a/workflow/.snapshots/TestRun-ec2_inst b/workflow/.snapshots/TestRun-ec2_inst index 18417542..0de8aae7 100644 --- a/workflow/.snapshots/TestRun-ec2_inst +++ b/workflow/.snapshots/TestRun-ec2_inst @@ -114,7 +114,7 @@ uid: (*string)((len=18) "scheduledinstances"), autocomplete: (*string)((len=23) "ec2 scheduledinstances "), arg: ([]string) (len=1) { - (string) (len=57) "https://us-west-2.console.aws.amazon.com/ec2sp/v2/si/home" + (string) (len=74) "https://us-west-2.console.aws.amazon.com/ec2sp/v2/si/home?region=us-west-2" }, valid: (bool) true, file: (bool) false, diff --git a/workflow/.snapshots/TestRun-ec2_instances b/workflow/.snapshots/TestRun-ec2_instances index 52089984..533c0b2b 100644 --- a/workflow/.snapshots/TestRun-ec2_instances +++ b/workflow/.snapshots/TestRun-ec2_instances @@ -78,7 +78,7 @@ uid: (*string)((len=18) "scheduledinstances"), autocomplete: (*string)((len=23) "ec2 scheduledinstances "), arg: ([]string) (len=1) { - (string) (len=57) "https://us-west-2.console.aws.amazon.com/ec2sp/v2/si/home" + (string) (len=74) "https://us-west-2.console.aws.amazon.com/ec2sp/v2/si/home?region=us-west-2" }, valid: (bool) true, file: (bool) false, diff --git a/workflow/.snapshots/TestRun-elasticbeanstalk_ b/workflow/.snapshots/TestRun-elasticbeanstalk_ index 4fee51e5..9f8616d1 100644 --- a/workflow/.snapshots/TestRun-elasticbeanstalk_ +++ b/workflow/.snapshots/TestRun-elasticbeanstalk_ @@ -78,7 +78,7 @@ uid: (*string)((len=13) "changehistory"), autocomplete: (*string)((len=31) "elasticbeanstalk changehistory "), arg: ([]string) (len=1) { - (string) (len=76) "https://us-west-2.console.aws.amazon.com/elasticbeanstalk/home/changeHistory" + (string) (len=93) "https://us-west-2.console.aws.amazon.com/elasticbeanstalk/home/changeHistory?region=us-west-2" }, valid: (bool) true, file: (bool) false,