fix(core): 优化 SubStore 节点重命名规则与错位匹配逻辑

This commit is contained in:
Orion
2026-06-03 15:20:57 +08:00
parent edb7d167c0
commit ca2274791b
2 changed files with 26 additions and 2 deletions
+20 -1
View File
@@ -192,6 +192,19 @@
};
const normalizeHyphenatedRegionFeatures = name => {
const misplacedSequenceMatch = String(name).match(/^([A-Z]{2}(?:\s+[A-Z]{3})?)\s+01\s+(\d{1,2})-(.+)$/);
if (misplacedSequenceMatch) {
return [
misplacedSequenceMatch[1],
misplacedSequenceMatch[2].padStart(2, '0'),
misplacedSequenceMatch[3].trim()
]
.filter(Boolean)
.join(' ')
.replace(/\s{2,}/g, ' ')
.trim();
}
const hyphenatedMatch = String(name).match(/^([A-Z]{2})(?:\s+([A-Z]{3}))?-(.+)$/);
if (!hyphenatedMatch) return name;
@@ -211,7 +224,13 @@
}
const sequenceIndex = tokens.findIndex(token => /^\d{1,2}$/.test(token));
if (sequenceIndex === -1) return name;
if (sequenceIndex === -1) {
return [regionCode, tokens.join('-')]
.filter(Boolean)
.join(' ')
.replace(/\s{2,}/g, ' ')
.trim();
}
const sequenceNumber = tokens[sequenceIndex].padStart(2, '0');
const ingressTokens = tokens