Skip to content

Commit

Permalink
fixed region query param not being appended always (saves a redirect)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkoval committed Aug 9, 2024
1 parent 52ee242 commit af1fa64
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -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</string>
<key>uidata</key>
Expand Down
6 changes: 3 additions & 3 deletions searchers/.snapshots/TestCodePipelinePipelinesSearcher
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
uid: (*string)(<nil>),
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,
Expand Down Expand Up @@ -42,7 +42,7 @@
uid: (*string)(<nil>),
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,
Expand Down Expand Up @@ -78,7 +78,7 @@
uid: (*string)(<nil>),
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,
Expand Down
8 changes: 6 additions & 2 deletions util/aws_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion workflow/.snapshots/TestRun-cloudformation_
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions workflow/.snapshots/TestRun-codepipeline_pipelines_
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
uid: (*string)(<nil>),
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,
Expand Down Expand Up @@ -42,7 +42,7 @@
uid: (*string)(<nil>),
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,
Expand Down Expand Up @@ -78,7 +78,7 @@
uid: (*string)(<nil>),
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
uid: (*string)(<nil>),
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,
Expand Down
4 changes: 2 additions & 2 deletions workflow/.snapshots/TestRun-ec2_
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion workflow/.snapshots/TestRun-ec2_inst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion workflow/.snapshots/TestRun-ec2_instances
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion workflow/.snapshots/TestRun-elasticbeanstalk_
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit af1fa64

Please sign in to comment.