mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-23 03:33:53 +00:00
fix: address PBS custom port handling issue #346
PBS was incorrectly appending default port :8007 even when custom ports were specified, resulting in malformed URLs like domain:443:8007. Now properly detects existing ports after the protocol prefix.
This commit is contained in:
@@ -392,7 +392,15 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {
|
||||
host = "https://" + host
|
||||
}
|
||||
// Add default PBS port if missing
|
||||
if !strings.Contains(host, ":8007") && !strings.Contains(host[8:], ":") {
|
||||
// Check if there's no port specified after the protocol
|
||||
protocolEnd := 0
|
||||
if strings.HasPrefix(host, "https://") {
|
||||
protocolEnd = 8
|
||||
} else if strings.HasPrefix(host, "http://") {
|
||||
protocolEnd = 7
|
||||
}
|
||||
// Only add default port if no port is specified
|
||||
if protocolEnd > 0 && !strings.Contains(host[protocolEnd:], ":") {
|
||||
host = host + ":8007"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user