Skip to content

Commit fb4ea40

Browse files
committed
fix(ip): trim whitespaces before validating ip
1 parent 3b42bf6 commit fb4ea40

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/controller/ip_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,12 @@ func (r *IPReconciler) getIPSource(ctx context.Context, source cloudflareoperato
223223
extractedIP = match[1]
224224
}
225225

226+
extractedIP = strings.TrimSpace(extractedIP)
226227
if net.ParseIP(extractedIP) == nil {
227228
return "", fmt.Errorf("ip from source %s is invalid: %s", source.URL, extractedIP)
228229
}
229230

230-
return strings.TrimSpace(extractedIP), nil
231+
return extractedIP, nil
231232
}
232233

233234
// handleStatic handles the static ip

0 commit comments

Comments
 (0)