fix: firmware upload failure

This commit is contained in:
2025-09-15 21:12:00 +02:00
parent d01f094edd
commit 2dbba87098
2 changed files with 22 additions and 2 deletions

View File

@@ -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,