fix(middleware): rate-limit key uses optional user ID pointer

This commit is contained in:
2026-05-06 20:13:56 +02:00
parent be64e7c8d2
commit 98985db537
+2 -2
View File
@@ -327,8 +327,8 @@ func GetSecureClientIP(r *http.Request) string {
func GetKey(r *http.Request) string { func GetKey(r *http.Request) string {
ip := GetSecureClientIP(r) ip := GetSecureClientIP(r)
if userID := GetUserIDFromContext(r.Context()); userID != 0 { if userID := GetUserIDFromContext(r.Context()); userID != nil {
return fmt.Sprintf("user:%d:ip:%s", userID, ip) return fmt.Sprintf("user:%d:ip:%s", *userID, ip)
} }
return fmt.Sprintf("ip:%s", ip) return fmt.Sprintf("ip:%s", ip)