fix: prevent folder-monitor reuploads after completion

Discover base, daily, session, and fallback upload logs across configured, Desktop, and application-data locations without blocking the Electron main process.

Treat in-session completion keys as authoritative automation evidence so removing finished rows cannot cause periodic reconciliation to enqueue and upload the same file again.

Add real handler and done-remove-reconcile regressions covering custom extensions, mixed-case log names, fallback paths, stale evidence, and asynchronous log reads.
This commit is contained in:
Sucukdeluxe
2026-08-27 13:22:35 +02:00
parent c0153acfb2
commit 58b92856a6
6 changed files with 182 additions and 27 deletions
+15 -1
View File
@@ -97,7 +97,21 @@
return out;
}
const api = { normalizeLogMode, resolveLogFileName, formatDateStamp, formatSessionStamp, stripModeStampFromFileName, VALID_MODES };
function isManagedUploadLogFileName(fileName, args) {
const value = String(fileName || '');
const options = args && typeof args === 'object' ? args : {};
const baseName = String(options.baseName || 'fileuploader');
const ext = String(options.ext || '.log');
const normalizedValue = value.toLowerCase();
const normalizedBaseName = baseName.toLowerCase();
const normalizedExt = ext.toLowerCase();
if (!normalizedExt || !normalizedValue.endsWith(normalizedExt)) return false;
if (stripModeStampFromFileName(normalizedValue) === `${normalizedBaseName}${normalizedExt}`) return true;
const stem = normalizedValue.slice(0, -normalizedExt.length);
return /^\d{2}-\d{2}-\d{4}-mdu-session-\d{2}-\d{2}(?:-\d+)?$/.test(stem);
}
const api = { normalizeLogMode, resolveLogFileName, formatDateStamp, formatSessionStamp, stripModeStampFromFileName, isManagedUploadLogFileName, VALID_MODES };
if (typeof module !== 'undefined' && module.exports) {
module.exports = api;