fix: firmware upload failure
This commit is contained in:
16
index.js
16
index.js
@@ -645,7 +645,21 @@ app.post('/api/node/update', async (req, res) => {
|
||||
|
||||
try {
|
||||
const updateResult = await nodeClient.updateFirmware(uploadedFile.data, uploadedFile.name);
|
||||
console.log(`Firmware upload to SPORE device ${nodeIp} completed successfully:`, updateResult);
|
||||
console.log(`Firmware upload to SPORE device ${nodeIp} completed:`, updateResult);
|
||||
|
||||
// Check if the SPORE device reported a failure
|
||||
if (updateResult && updateResult.status === 'FAIL') {
|
||||
console.error(`SPORE device ${nodeIp} reported firmware update failure:`, updateResult.message);
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
error: 'Firmware update failed',
|
||||
message: updateResult.message || 'Firmware update failed on device',
|
||||
nodeIp: nodeIp,
|
||||
fileSize: uploadedFile.data.length,
|
||||
filename: uploadedFile.name,
|
||||
result: updateResult
|
||||
});
|
||||
}
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user