-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: uri root path checking #5778
Conversation
@@ -409,7 +409,7 @@ func (u *accessURI) strings() []string { | |||
protocol = "https://" | |||
} | |||
path := "" | |||
if u.Path != "/" { | |||
if !strings.HasPrefix(Path, "/") { | |||
path = fmt.Sprintf("/%s", u.Path) | |||
} | |||
uris = append(uris, color.HighlightResource(protocol+dnsName+path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the user adds a path without the /
prefix, the path
variable here will still be ""
. I think we need to catch this case. Thanks!
Hi, @Folyd! Thanks so much for opening this PR! |
internal/pkg/describe/uri.go
Outdated
@@ -409,7 +409,7 @@ func (u *accessURI) strings() []string { | |||
protocol = "https://" | |||
} | |||
path := "" | |||
if u.Path != "/" { | |||
if !strings.HasPrefix(Path, "/") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !strings.HasPrefix(Path, "/") { | |
if !strings.HasPrefix(u.Path, "/") { |
@huanjani Thanks for reviewing, I fixed it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one small fix, but looks great otherwise! thanks for the fix and adding those test cases 😊
@@ -409,8 +409,10 @@ func (u *accessURI) strings() []string { | |||
protocol = "https://" | |||
} | |||
path := "" | |||
if u.Path != "/" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this misses a case with a path with multiple slashes, like ///foo
. that should be solved by just changing the else if
to an else
(or drop the else
like this)!
if u.Path != "/" { | |
path := u.Path | |
if !strings.HasPrefix(u.Path, "/") { | |
path = fmt.Sprintf("/%s", u.Path) | |
} |
🍕 Here are the new binary sizes!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks so much!
The fix is now released in v1.33.4: /~https://github.com/aws/copilot-cli/releases/tag/v1.33.4! 🎉 Thanks @Folyd for the PR! |
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
This config will display
Your service is accessible at https://my-domain.com//v2
after deploy successfully.This PR fix this.