KOP-XIAO / QuantumultX

2.72k stars 614 forks source link

fix "@" symbol in replace #18

Closed shadowdogy closed 3 years ago

shadowdogy commented 3 years ago

当在replace中使用“@”符号作为替换对象时会出错。如:

replace=https://raw.githubusercontent.com\/(.*?)\/(.*?)\/(.*)@https://cdn.jsdelivr.net/gh/$1/$2@$3
or
replace=https://raw.githubusercontent.com\/(.*?)\/(.*?)\/(.*)@https://cdn.jsdelivr.net/gh/$1/$2%40$3

原因在于,第一步解析replace参数时,就会将"%40" decode 成 “@”。从而在之后的 replace 中使用 “@” 分割正则表达式和替换表达时出错。因此把 urldecode 延后在分割之后分别进行。这时使用如下参数就可以替换成功:

replace=https://raw.githubusercontent.com\/(.*?)\/(.*?)\/(.*)@https://cdn.jsdelivr.net/gh/$1/$2%40$3
--->
https://cdn.jsdelivr.net/gh/username/repo@master/bala/bala.txt