修复UserAgentUtil对QQ浏览器识别问题

This commit is contained in:
Looly 2024-01-18 16:12:28 +08:00
parent 5bbafaafbc
commit eeeaf7664a
3 changed files with 19 additions and 2 deletions

View File

@ -2,11 +2,12 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.26(2024-01-16)
# 5.8.26(2024-01-18)
### 🐣新特性
### 🐞Bug修复
* 【crypto】 修复BouncyCastleProvider导致graalvm应用报错UnsupportedFeatureErrorpr#3464@Github
* 【http 】 修复UserAgentUtil对QQ浏览器识别问题issue#I8X5XQ@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.8.25(2024-01-11)

View File

@ -36,7 +36,7 @@ public class Browser extends UserAgentInfo {
// 微信小程序
new Browser("miniProgram", "miniProgram", Other_Version),
// QQ浏览器
new Browser("QQBrowser", "MQQBrowser", "MQQBrowser\\/([\\d\\w\\.\\-]+)"),
new Browser("QQBrowser", "QQBrowser", "QQBrowser\\/([\\d\\w\\.\\-]+)"),
// 钉钉PC端浏览器
new Browser("DingTalk-win", "dingtalk-win", "DingTalk\\(([\\d\\w\\.\\-]+)\\)"),
// 钉钉内置浏览器

View File

@ -472,4 +472,20 @@ public class UserAgentUtilTest {
Assert.assertEquals("iPhone", ua2.getPlatform().toString());
Assert.assertTrue(ua2.isMobile());
}
@Test
public void issueI8X5XQTest() {
final String s = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 " +
"Safari/537.36 Core/1.94.218.400 QQBrowser/12.1.5496.400";
final UserAgent ua2 = UserAgentUtil.parse(s);
Assert.assertEquals("QQBrowser", ua2.getBrowser().toString());
Assert.assertEquals("12.1.5496.400", ua2.getVersion());
Assert.assertEquals("Webkit", ua2.getEngine().toString());
Assert.assertEquals("537.36", ua2.getEngineVersion());
Assert.assertEquals("Windows 10 or Windows Server 2016", ua2.getOs().toString());
Assert.assertEquals("10.0", ua2.getOsVersion());
Assert.assertEquals("Windows", ua2.getPlatform().toString());
Assert.assertFalse(ua2.isMobile());
}
}