feat: handle missing trailing slashes for console and login (#3490)

* handle calls without trailing slash

* build redirect uris correctly

* handle missing trailing slash for login

* sentry as http middleware

* import

* fix build origin
This commit is contained in:
Livio Amstutz
2022-04-26 12:13:16 +02:00
committed by GitHub
parent 388ef6b93b
commit 32986aa60a
5 changed files with 14 additions and 12 deletions

View File

@@ -32,11 +32,10 @@ func IsOrigin(rawOrigin string) bool {
}
func BuildHTTP(hostname string, externalPort uint16, secure bool) string {
host := hostname
if externalPort != 0 {
host = fmt.Sprintf("%s:%d", hostname, externalPort)
if externalPort == 0 || (externalPort == 443 && secure) || (externalPort == 80 && !secure) {
return BuildOrigin(hostname, secure)
}
return BuildOrigin(host, secure)
return BuildOrigin(fmt.Sprintf("%s:%d", hostname, externalPort), secure)
}
func BuildOrigin(host string, secure bool) string {