diff --git a/packages/server/src/utils/createAttachment.ts b/packages/server/src/utils/createAttachment.ts index 9e9228f15..10495140d 100644 --- a/packages/server/src/utils/createAttachment.ts +++ b/packages/server/src/utils/createAttachment.ts @@ -32,7 +32,7 @@ export const createFileAttachment = async (req: Request) => { if (!chatflowid || !isValidUUID(chatflowid)) { throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'Invalid chatflowId format - must be a valid UUID') } - if (isPathTraversal(chatflowid) || isPathTraversal(chatId)) { + if (isPathTraversal(chatflowid) || (chatId && isPathTraversal(chatId))) { throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'Invalid path characters detected') }