Skip to content

Commit bf3b475

Browse files
committed
fix: qx jq 转 surge 和 loon 时, 包裹单引号, close #47
1 parent 7ff66d0 commit bf3b475

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

Rewrite-Parser.beta.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,20 @@ if (binaryInfo != null && binaryInfo.length > 0) {
576576
}
577577
if (value) {
578578
value = value.replace(/\s+\/\//g, '//')
579-
rwbodyBox.push({ type: `http-${type}-jq`, regex, value })
579+
rwbodyBox.push({
580+
type: `http-${type}-jq`,
581+
regex,
582+
value: value.startsWith("'") && value.endsWith("'") ? value : `'${value}'`,
583+
})
580584
}
581585
} else if (isLooniOS) {
582-
;/body-json-jq/.test(_x) ? URLRewrite.push(_x) : URLRewrite.push(`${regex} ${type}-body-json-jq ${value}`)
586+
if (/body-json-jq/.test(_x)) {
587+
URLRewrite.push(_x)
588+
} else {
589+
URLRewrite.push(
590+
`${regex} ${type}-body-json-jq ${value.startsWith("'") && value.endsWith("'") ? value : `'${value}'`}`
591+
)
592+
}
583593
}
584594
}
585595

Rewrite-Parser.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,20 @@ if (binaryInfo != null && binaryInfo.length > 0) {
576576
}
577577
if (value) {
578578
value = value.replace(/\s+\/\//g, '//')
579-
rwbodyBox.push({ type: `http-${type}-jq`, regex, value })
579+
rwbodyBox.push({
580+
type: `http-${type}-jq`,
581+
regex,
582+
value: value.startsWith("'") && value.endsWith("'") ? value : `'${value}'`,
583+
})
580584
}
581585
} else if (isLooniOS) {
582-
;/body-json-jq/.test(_x) ? URLRewrite.push(_x) : URLRewrite.push(`${regex} ${type}-body-json-jq ${value}`)
586+
if (/body-json-jq/.test(_x)) {
587+
URLRewrite.push(_x)
588+
} else {
589+
URLRewrite.push(
590+
`${regex} ${type}-body-json-jq ${value.startsWith("'") && value.endsWith("'") ? value : `'${value}'`}`
591+
)
592+
}
583593
}
584594
}
585595

0 commit comments

Comments
 (0)