mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: Split host and port before storing IP (#2594)
The IP was always nil prior, and this fixes the test to check for that as well!
This commit is contained in:
+2
-1
@@ -782,7 +782,8 @@ func (api *API) createAPIKey(rw http.ResponseWriter, r *http.Request, params dat
|
||||
}
|
||||
}
|
||||
|
||||
ip := net.ParseIP(r.RemoteAddr)
|
||||
host, _, _ := net.SplitHostPort(r.RemoteAddr)
|
||||
ip := net.ParseIP(host)
|
||||
if ip == nil {
|
||||
ip = net.IPv4(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user