mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-29 14:38:52 +03:00
Fix #2777
This commit is contained in:
parent
aad087caac
commit
d1175ff471
1 changed files with 16 additions and 7 deletions
|
@ -292,14 +292,23 @@ exports.postgresQuery = function (connectionString, query) {
|
||||||
client.end();
|
client.end();
|
||||||
} else {
|
} else {
|
||||||
// Connected here
|
// Connected here
|
||||||
client.query(query, (err, res) => {
|
try {
|
||||||
if (err) {
|
// No query provided by user, use SELECT 1
|
||||||
reject(err);
|
if (!query || (typeof query === "string" && query.trim() === "")) {
|
||||||
} else {
|
query = "SELECT 1";
|
||||||
resolve(res);
|
|
||||||
}
|
}
|
||||||
client.end();
|
|
||||||
});
|
client.query(query, (err, res) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
resolve(res);
|
||||||
|
}
|
||||||
|
client.end();
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue