mirror of
https://github.com/koichixD/uptime-kuma.git
synced 2026-09-04 17:23:21 +00:00
fix: idn ping errors (#6662)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -157,6 +157,16 @@ exports.pingAsync = function (
|
||||
deadline = PING_GLOBAL_TIMEOUT_DEFAULT,
|
||||
timeout = PING_PER_REQUEST_TIMEOUT_DEFAULT
|
||||
) {
|
||||
try {
|
||||
const url = new URL(`http://${destAddr}`);
|
||||
destAddr = url.hostname;
|
||||
if (destAddr.startsWith("[") && destAddr.endsWith("]")) {
|
||||
destAddr = destAddr.slice(1, -1);
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
ping.promise
|
||||
.probe(destAddr, {
|
||||
|
||||
Reference in New Issue
Block a user