Improve validation when checking for nodeId
This commit is contained in:
@@ -110,7 +110,7 @@ exports.getOnlineNodes = (callback) => {
|
|||||||
* @param callback Callback function
|
* @param callback Callback function
|
||||||
*/
|
*/
|
||||||
async function getNodeInfoFromId(nodeId, callback = undefined) {
|
async function getNodeInfoFromId(nodeId, callback = undefined) {
|
||||||
if (!nodeId) throw new Error("No node ID given when trying to fetch node");
|
if (!nodeId || nodeId == '0' || nodeId == 0 ) throw new Error("No node ID given when trying to fetch node");
|
||||||
log.DEBUG("Getting node from ID: ", nodeId);
|
log.DEBUG("Getting node from ID: ", nodeId);
|
||||||
const sqlQuery = `SELECT * FROM ${nodesTable} WHERE id = ${nodeId}`
|
const sqlQuery = `SELECT * FROM ${nodesTable} WHERE id = ${nodeId}`
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user