mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-11 18:29:41 +08:00
Address all security review comments: sanitize remaining error messages and handle errors properly
Co-authored-by: krau <71133316+krau@users.noreply.github.com>
This commit is contained in:
@@ -91,7 +91,12 @@ func getClientIP(r *http.Request) string {
|
||||
}
|
||||
|
||||
// Fall back to RemoteAddr
|
||||
ip, _, _ := net.SplitHostPort(r.RemoteAddr)
|
||||
ip, _, err := net.SplitHostPort(r.RemoteAddr)
|
||||
if err != nil {
|
||||
// If SplitHostPort fails, RemoteAddr might not have a port
|
||||
// In this case, just return RemoteAddr as is
|
||||
return r.RemoteAddr
|
||||
}
|
||||
return ip
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user