mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 02:15:51 +00:00
fix(backups): pin a single bracket-free IP for mc --resolve
S3 backup uploads fail when the endpoint has an AAAA record: mc parses --resolve values with netip.ParseAddr and rejects the bracketed IPv6 form. Its resolver map also keeps only one IP per host, so emit a single entry, preferring IPv4, without brackets.
This commit is contained in:
1 parent
f06bacc8e0
commit
12033e8091
2 files changed
+23
-3
No files matched your search
@@ -134,10 +134,17 @@ class SafeWebhookUrl implements ValidationRule
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map(
|
||||
fn (string $ip): string => sprintf('%s:%d=%s', $target['host'], $target['port'], filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ? '['.$ip.']' : $ip),
|
||||
// The MinIO client keeps one --resolve IP per host and parses it with Go's
|
||||
// netip.ParseAddr, which rejects bracketed IPv6. Emit a single entry, preferring
|
||||
// IPv4 for reachability, without brackets.
|
||||
$preferredIps = array_values(array_filter(
|
||||
$target['ips'],
|
||||
);
|
||||
fn (string $ip): bool => filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false,
|
||||
));
|
||||
|
||||
$ip = $preferredIps[0] ?? $target['ips'][0];
|
||||
|
||||
return [sprintf('%s:%d=%s', $target['host'], $target['port'], $ip)];
|
||||
}
|
||||
|
||||
public static function redactedUrlForLog(string $url): string
|
||||
|
||||
Reference in new issue
Block a user