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:
+15
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user