The minimalistic document archiving platform.
fix(ingestion-folders): ensure doneFolders and errorFolders are string arrays for proper exclusion pattern (#483)
Corentin Thomassetec0a437d86b4
diff --git a/.changeset/cold-walls-drop.md b/.changeset/cold-walls-drop.mdnew file mode 100644index 00000000..cbd36511--- /dev/null+++ b/.changeset/cold-walls-drop.md@@ -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.diff --git a/apps/papra-server/src/modules/ingestion-folders/ingestion-folders.usecases.ts b/apps/papra-server/src/modules/ingestion-folders/ingestion-folders.usecases.tsindex e84edefc..07054c00 100644--- a/apps/papra-server/src/modules/ingestion-folders/ingestion-folders.usecases.ts+++ b/apps/papra-server/src/modules/ingestion-folders/ingestion-folders.usecases.ts@@ -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);