Skip to content

Commit 06202bb

Browse files
author
Ajit Kumar
committed
fix( #4 )
1 parent d392753 commit 06202bb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

server/apis/plugin.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ router.post('/', async (req, res) => {
421421
insert.push([Plugin.CHANGELOGS, changelogs]);
422422
}
423423

424-
if (req.body.changelogs) {
424+
if (req.body?.changelogs) {
425425
insert.push([Plugin.CHANGELOGS, req.body.changelogs]);
426426
}
427427

@@ -457,7 +457,8 @@ router.post('/', async (req, res) => {
457457
}
458458
});
459459
} catch (error) {
460-
res.status(500).send({ error: error.message });
460+
console.error('Error uploading plugin:', error);
461+
res.status(500).send({ error: 'Unable to upload plugin, please try again later, if issue persists contact support.' });
461462
}
462463
});
463464

@@ -529,7 +530,7 @@ router.put('/', async (req, res) => {
529530
updates.push([Plugin.CHANGELOGS, changelogs]);
530531
}
531532

532-
if (req.body.changelogs) {
533+
if (req.body?.changelogs) {
533534
updates.push([Plugin.CHANGELOGS, req.body.changelogs]);
534535
}
535536

@@ -562,7 +563,8 @@ router.put('/', async (req, res) => {
562563
}
563564
res.send({ message: 'Plugin updated successfully' });
564565
} catch (error) {
565-
res.status(500).send({ error: error.message });
566+
console.error('Error updating plugin:', error);
567+
res.status(500).send({ error: 'Unable to update plugin, please try again later, if issue persists contact support.' });
566568
}
567569
});
568570

0 commit comments

Comments
 (0)