fix: add YYYYMMDD format validation in flusher.js cleanup
Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/d584fa04-35a0-4fec-b035-67f9f5e113eb
This commit is contained in:
parent
17803a5e39
commit
a13685b2c5
|
|
@ -195,7 +195,10 @@ function cleanupProcessed(keepDays) {
|
||||||
.filter(d => fs.statSync(path.join(PROCESSED, d)).isDirectory());
|
.filter(d => fs.statSync(path.join(PROCESSED, d)).isDirectory());
|
||||||
|
|
||||||
for (const dir of dirs) {
|
for (const dir of dirs) {
|
||||||
// 目录名格式: YYYYMMDD
|
// 目录名格式: YYYYMMDD — 必须是 8 位数字
|
||||||
|
if (!/^\d{8}$/.test(dir)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const year = parseInt(dir.substring(0, 4));
|
const year = parseInt(dir.substring(0, 4));
|
||||||
const month = parseInt(dir.substring(4, 6)) - 1;
|
const month = parseInt(dir.substring(4, 6)) - 1;
|
||||||
const day = parseInt(dir.substring(6, 8));
|
const day = parseInt(dir.substring(6, 8));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue