Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0.2版 Chrome扩展]当URL上含有中文GBK编码字符时规则无法生效 #103

Closed
miaolapd opened this issue Oct 27, 2018 · 7 comments

Comments

@miaolapd
Copy link

我设了个修改User-Agent的规则:

规则类型:修改请求头
匹配类型:域名
域名:随便
头名称:user-agent
头内容:Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

在一般情况下,当访问我设定的域名时,这条规则都能正常生效,在开发者工具查看请求头就能发现UA被修改了
但是当url包含了GBK编码的字符串时,这条规则就失效了,比如URL中含有下面的字符串时:
?k=%BF%C6%BB%C3
在开发者工具查看请求头发现还是浏览器本身的UA,并未被修改

@sylingd
Copy link
Member

sylingd commented Oct 27, 2018

能否提供一个测试地址?

@miaolapd
Copy link
Author

能否提供一个测试地址?

随便在哪个网址上加上【?k=%BF%C6%BB%C3】像这样含有GBK编码的字符串都会出现这种BUG
比如:https://bbs.2dkf.com/?k=%BF%C6%BB%C3

@miaolapd
Copy link
Author

miaolapd commented Oct 27, 2018

能否提供一个测试地址?

我又试了一下,是在匹配类型为域名的情况下会出现这个BUG

@sylingd
Copy link
Member

sylingd commented Oct 28, 2018

已修复。感谢反馈。
问题原因是,使用了parse-path库。此库会自动解析查询字符串(即?后的字符串)。扩展运行于UTF-8编码下,如果有非UTF-8编码的查询字符串,则会解析失败触发异常。
解决方案:自行实现解析URL的功能。

@miaolapd
Copy link
Author

感谢修复~~~

@sylingd
Copy link
Member

sylingd commented Oct 29, 2018

我已经发布了4.0.3,请更新测试

@miaolapd
Copy link
Author

miaolapd commented Oct 29, 2018

我已经发布了4.0.3,请更新测试

4.0.3没问题了~ 感谢修正~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants