fix: parse escaped retryable error messages

This commit is contained in:
2026-07-08 10:08:25 +08:00
parent a62f2cf1b9
commit 5d48ef5880
4 changed files with 64 additions and 15 deletions
+8 -1
View File
@@ -169,6 +169,13 @@ function normalizePath(inputPath) {
return trimmed || "/";
}
function expandEscapedLineBreaks(value) {
return `${value ?? ""}`
.replace(/\\r\\n/g, "\n")
.replace(/\\n/g, "\n")
.replace(/\\r/g, "\n");
}
function flattenValues(value) {
if (Array.isArray(value)) {
return value.flatMap((item) => flattenValues(item));
@@ -503,7 +510,7 @@ function normalizePhraseList(values, fallback = []) {
const normalized = flattenValues(source)
.flatMap((value) => {
if (typeof value === "string") {
return value.split(/\r?\n/);
return expandEscapedLineBreaks(value).split(/\r?\n/);
}
return [value];
})