Skip to content

Commit 4501d2e

Browse files
committed
fix: 暴力修复 Loon JQ 行尾注释截断
1 parent 1f131d4 commit 4501d2e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Rewrite-Parser.beta.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
345345
body = body.match(/[^\r\n]+/g)
346346

347347
for await (let [y, x] of body.entries()) {
348+
// 保持原始 x
349+
const _x = x
348350
//简单处理方便后续操作
349351
x = x
350352
.trim()
@@ -555,8 +557,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
555557
rw_redirect(x, mark)
556558
}
557559

558-
if (/\s((request|response)-body-json-jq)\s/.test(x)) {
559-
let [_, regex, type, value] = x.match(/^(.*?)\s+?(?:(request|response)-body-json-jq)\s+?(.*?)\s*$/)
560+
if (/\s((request|response)-body-json-jq)\s/.test(_x)) {
561+
let [_, regex, type, value] = _x.match(/^(.*?)\s+?(?:(request|response)-body-json-jq)\s+?(.*?)\s*$/)
560562
if (jqEnabled && isSurgeiOS) {
561563
const jqPath = value.match(/jq-path="(.+?)"/)?.[1]
562564
if (jqPath) {

Rewrite-Parser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
345345
body = body.match(/[^\r\n]+/g)
346346

347347
for await (let [y, x] of body.entries()) {
348+
// 保持原始 x
349+
const _x = x
348350
//简单处理方便后续操作
349351
x = x
350352
.trim()
@@ -555,8 +557,8 @@ if (binaryInfo != null && binaryInfo.length > 0) {
555557
rw_redirect(x, mark)
556558
}
557559

558-
if (/\s((request|response)-body-json-jq)\s/.test(x)) {
559-
let [_, regex, type, value] = x.match(/^(.*?)\s+?(?:(request|response)-body-json-jq)\s+?(.*?)\s*$/)
560+
if (/\s((request|response)-body-json-jq)\s/.test(_x)) {
561+
let [_, regex, type, value] = _x.match(/^(.*?)\s+?(?:(request|response)-body-json-jq)\s+?(.*?)\s*$/)
560562
if (jqEnabled && isSurgeiOS) {
561563
const jqPath = value.match(/jq-path="(.+?)"/)?.[1]
562564
if (jqPath) {

0 commit comments

Comments
 (0)