diff --git a/backend/routes/ivantiFpWorkflow.js b/backend/routes/ivantiFpWorkflow.js index 523ad32..38947b4 100644 --- a/backend/routes/ivantiFpWorkflow.js +++ b/backend/routes/ivantiFpWorkflow.js @@ -260,6 +260,12 @@ function createIvantiFpWorkflowRouter() { const foundIds = new Set(libraryDocs.map(d => d.id)); const missingIds = libraryDocIds.filter(id => !foundIds.has(id)); if (missingIds.length > 0) return res.status(400).json({ error: `Library document IDs not found: ${missingIds.join(', ')}` }); + // Validate file types for library docs (same rules as local uploads) + const unsupportedDocs = libraryDocs.filter(d => !isAllowedFileExtension(d.name)); + if (unsupportedDocs.length > 0) { + const names = unsupportedDocs.map(d => d.name).join(', '); + return res.status(400).json({ error: `Library document file type not supported by Ivanti: ${names}. Allowed: ${[...ALLOWED_EXTENSIONS].join(', ')}` }); + } } const libraryFormFiles = []; @@ -821,6 +827,12 @@ function createIvantiFpWorkflowRouter() { const foundIds = new Set(libraryDocs.map(d => d.id)); const missingIds = libraryDocIds.filter(id => !foundIds.has(id)); if (missingIds.length > 0) return res.status(400).json({ error: `Library document IDs not found: ${missingIds.join(', ')}` }); + // Validate file types for library docs + const unsupportedDocs = libraryDocs.filter(d => !isAllowedFileExtension(d.name)); + if (unsupportedDocs.length > 0) { + const names = unsupportedDocs.map(d => d.name).join(', '); + return res.status(400).json({ error: `Library document file type not supported by Ivanti: ${names}. Allowed: ${[...ALLOWED_EXTENSIONS].join(', ')}` }); + } } const apiKey = process.env.IVANTI_API_KEY;