remove trailing slash for overrideUrlName#216
Conversation
|
Regading the failed build looks like it's something unrelated to the code: |
| var overrideUrlName_sanitized string | ||
| // ignore error, overrideBaseUrl may not be set in hal config | ||
| statusUrl, _ := t.svc.GetSpinnakerConfig().GetHalConfigPropString(ctx, overrideUrlName) | ||
| if overrideUrlName[len(overrideUrlName)-1:] == "/" { |
There was a problem hiding this comment.
You should leverage strings and do strings.HasPrefix(overrideUrlName, "/")
if strings.HasPrefix(overrideUrlName, "/") {
overrideUrlName = overrideUrlName[:len(overrideUrlName) - 1]
}
You could drop the else and the additional variable.
|
Good point, although it is actually HasSuffix: tests whether the string s ends with suffix. I have pushed an amended commit for this |
|
This change is quite straightforward and it's going to help users avoid getting stuck with this issue. Can someone take a look? |
|
Thank you for this, I don't have permissions to merge this until the actions have passed let me see who can help us get this merge |
|
@jordiprats can you help us rebasing to the latest commits in master or maybe create an empty commit just to re-run the actions and see the output. |
Hi,
This PR is for fixing what could be also considered as a configuration mistake. If you set overrideBaseUrl to an url with a trailing slash as follows:
It looks like everything is fine but if you click on the source link on any pipeline you'll get this error message:
Taking a look at the URL you'll realize there's a double slash after the hostname which leads to this error. On my PR you'll find the code needed for ignoring this final slash: It doesn't even matter if you remove it or add the final slash: the operator won't even bother updating the containers because it's just ignored
kind regards,