mirror of
				https://github.com/louislam/uptime-kuma.git
				synced 2025-11-04 13:46:13 +08:00 
			
		
		
		
	Restructured condition + ensure data is UTF-8
Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
		@@ -103,12 +103,10 @@ exports.pingAsync = function (hostname, ipv6 = false) {
 | 
			
		||||
            min_reply: 3
 | 
			
		||||
        }).then((res) => {
 | 
			
		||||
            // If ping failed, it will set field to unknown
 | 
			
		||||
            if (!res.alive && res.host === "unknown") {
 | 
			
		||||
                reject(new Error("Name or service not known"));
 | 
			
		||||
            } else if (res.time === "unknown") {
 | 
			
		||||
                reject(new Error(res.output));
 | 
			
		||||
            } else {
 | 
			
		||||
            if (res.alive) {
 | 
			
		||||
                resolve(res.time);
 | 
			
		||||
            } else {
 | 
			
		||||
                reject(new Error(exports.convertToUTF8(res.output)));
 | 
			
		||||
            }
 | 
			
		||||
        }).catch((err) => {
 | 
			
		||||
            reject(err);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user