From ec0a437d86b4c8c0979ba9d0c2ff7b39f054cec0 Mon Sep 17 00:00:00 2001 From: Corentin Thomasset Date: Mon, 8 Sep 2025 23:36:04 +0200 Subject: [PATCH] fix(ingestion-folders): ensure doneFolders and errorFolders are string arrays for proper exclusion pattern (#483) --- .changeset/cold-walls-drop.md | 5 +++++ .../modules/ingestion-folders/ingestion-folders.usecases.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/cold-walls-drop.md diff --git a/.changeset/cold-walls-drop.md b/.changeset/cold-walls-drop.md new file mode 100644 index 0000000..cbd3651 --- /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.ts index e84edef..07054c0 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);