Upload public.js
Browse files- backend/src/routes/public.js +10 -0
backend/src/routes/public.js
CHANGED
@@ -415,6 +415,11 @@ router.get('/screenshot/:userId/:pptId/:slideIndex?', async (req, res, next) =>
|
|
415 |
return res.status(404).json({ error: 'PPT not found' });
|
416 |
}
|
417 |
|
|
|
|
|
|
|
|
|
|
|
418 |
const slideIdx = parseInt(slideIndex);
|
419 |
if (slideIdx >= pptData.slides.length || slideIdx < 0) {
|
420 |
return res.status(404).json({ error: 'Invalid slide index' });
|
@@ -659,6 +664,11 @@ router.get('/screenshot-data/:userId/:pptId/:slideIndex?', async (req, res, next
|
|
659 |
return res.status(404).json({ error: 'PPT not found' });
|
660 |
}
|
661 |
|
|
|
|
|
|
|
|
|
|
|
662 |
const slideIdx = parseInt(slideIndex);
|
663 |
if (slideIdx >= pptData.slides.length || slideIdx < 0) {
|
664 |
return res.status(404).json({ error: 'Invalid slide index' });
|
|
|
415 |
return res.status(404).json({ error: 'PPT not found' });
|
416 |
}
|
417 |
|
418 |
+
// Check if slides array exists
|
419 |
+
if (!pptData.slides || !Array.isArray(pptData.slides)) {
|
420 |
+
return res.status(400).json({ error: 'Invalid PPT data: slides not found' });
|
421 |
+
}
|
422 |
+
|
423 |
const slideIdx = parseInt(slideIndex);
|
424 |
if (slideIdx >= pptData.slides.length || slideIdx < 0) {
|
425 |
return res.status(404).json({ error: 'Invalid slide index' });
|
|
|
664 |
return res.status(404).json({ error: 'PPT not found' });
|
665 |
}
|
666 |
|
667 |
+
// Check if slides array exists
|
668 |
+
if (!pptData.slides || !Array.isArray(pptData.slides)) {
|
669 |
+
return res.status(400).json({ error: 'Invalid PPT data: slides not found' });
|
670 |
+
}
|
671 |
+
|
672 |
const slideIdx = parseInt(slideIndex);
|
673 |
if (slideIdx >= pptData.slides.length || slideIdx < 0) {
|
674 |
return res.status(404).json({ error: 'Invalid slide index' });
|