Copilot commented on code in PR #3331:
URL: https://github.com/apache/dubbo-go/pull/3331#discussion_r3278819700
##########
config_center/apollo/impl.go:
##########
@@ -224,8 +224,11 @@ func (c *apolloConfiguration)
getAddressWithProtocolPrefix(url *common.URL) stri
addrs := make([]string, 0)
for _, part := range parts {
addr := part
+ if url.Path != "" {
+ addr = strings.TrimRight(addr, "/") + "/" +
strings.TrimLeft(url.Path, "/")
Review Comment:
`url.Path` can be `"/"` when the configured Apollo address ends with a
trailing slash (e.g. `apollo://127.0.0.1:8080/`). With the current logic, this
appends a `/` to each address and changes the previous output from
`http://127.0.0.1:8080` to `http://127.0.0.1:8080/`, which may break
expectations and can cause double-slashes when Apollo endpoints are appended
later. Consider treating `"/"` (or an all-slashes path) as empty, and add a
test case to lock this behavior in.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]