@arela/uploader 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -311,6 +311,9 @@ export class IdentifyCommand {
|
|
|
311
311
|
return {
|
|
312
312
|
processed: 0,
|
|
313
313
|
detected: 0,
|
|
314
|
+
// Must include every field totalStats accumulates — omitting proformas
|
|
315
|
+
// made `totalStats.proformas += undefined` = NaN in the final summary.
|
|
316
|
+
proformas: 0,
|
|
314
317
|
errors: 0,
|
|
315
318
|
};
|
|
316
319
|
}
|
|
@@ -64,16 +64,21 @@ function toRegExp(clue) {
|
|
|
64
64
|
return re;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
|
|
67
|
+
// Bound the text a single regex runs on so an allowed (quadratic) pattern
|
|
68
|
+
// can't blow up on a megabyte-scale adversarial string. Real documents can
|
|
69
|
+
// legitimately exceed the cap (edocument XMLs embed multi-MB base64 PDFs with
|
|
70
|
+
// signature tags AFTER the blob), so instead of truncating we sample a HEAD +
|
|
71
|
+
// TAIL window — signatures live at the extremes, the blob in the middle.
|
|
72
|
+
// (Parity with the API TS engine.)
|
|
73
|
+
const MATCH_HEAD_CAP = 1_000_000;
|
|
74
|
+
const MATCH_TAIL_CAP = 262_144;
|
|
71
75
|
|
|
72
76
|
function clueTarget(clue, ctx) {
|
|
73
77
|
// FILENAME_REGEX tests the file name; every other kind tests the content.
|
|
74
78
|
const raw =
|
|
75
79
|
clue.kind === 'FILENAME_REGEX' ? (ctx.fileName ?? '') : (ctx.source ?? '');
|
|
76
|
-
|
|
80
|
+
if (raw.length <= MATCH_HEAD_CAP + MATCH_TAIL_CAP) return raw;
|
|
81
|
+
return `${raw.slice(0, MATCH_HEAD_CAP)}\n${raw.slice(-MATCH_TAIL_CAP)}`;
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
/**
|
|
@@ -81,6 +81,10 @@ export class LoggingService {
|
|
|
81
81
|
*/
|
|
82
82
|
info(message) {
|
|
83
83
|
this.writeLog(message, 'info');
|
|
84
|
+
// Echo to console: run banners, stats and the 🧩 observability lines were
|
|
85
|
+
// file-only, so operators watching the terminal never saw them (the v1
|
|
86
|
+
// canary summary was invisible until someone grepped arela-upload.log).
|
|
87
|
+
console.log(message);
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
/**
|
|
@@ -89,9 +93,7 @@ export class LoggingService {
|
|
|
89
93
|
*/
|
|
90
94
|
warn(message) {
|
|
91
95
|
this.writeLog(message, 'warn');
|
|
92
|
-
|
|
93
|
-
console.warn(`⚠️ ${message}`);
|
|
94
|
-
}
|
|
96
|
+
console.warn(`⚠️ ${message}`);
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
/**
|