fix(ingestion-folders): ensure doneFolders and errorFolders are string arrays for proper exclusion pattern (#483)

This commit is contained in:
Corentin Thomasset
2025-09-08 23:36:04 +02:00
committed by GitHub
parent 1606310745
commit ec0a437d86
2 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@papra/app-server": patch
---
Fix a bug where the ingestion folder was not working when the done or error destination folder path (INGESTION_FOLDER_POST_PROCESSING_MOVE_FOLDER_PATH and INGESTION_FOLDER_ERROR_FOLDER_PATH) were absolute.

View File

@@ -235,10 +235,10 @@ async function buildPathIgnoreFunction({
const { organizationIds } = await organizationsRepository.getAllOrganizationIds();
const doneFolders = strategy === 'move'
? isAbsolute(moveToFolderPath) ? moveToFolderPath : uniq(organizationIds.map(id => join(cwd, folderRootPath, id, moveToFolderPath)))
? isAbsolute(moveToFolderPath) ? [moveToFolderPath] : uniq(organizationIds.map(id => join(cwd, folderRootPath, id, moveToFolderPath)))
: [];
const errorFolders = isAbsolute(errorFolder) ? errorFolder : uniq(organizationIds.map(id => join(cwd, folderRootPath, id, errorFolder)));
const errorFolders = isAbsolute(errorFolder) ? [errorFolder] : uniq(organizationIds.map(id => join(cwd, folderRootPath, id, errorFolder)));
const ignoredFolders = [...doneFolders, ...errorFolders];
const matchExcludedPatterns = picomatch(ignoredPatterns);