From 88e4cbc43a5ba0c47391bbde9ffabdee3bd0d6d3 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 21 Feb 2024 16:45:13 +0100 Subject: [PATCH] fix: parse properly Chrome on iOS with request desktop (#559) The UA for Chrome on iOS doesn't specify the full Chrome version, but only the major. This changes the regex so that both minor & patch versions are optional. --- regexes.yaml | 2 +- tests/test_ua.yaml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/regexes.yaml b/regexes.yaml index 51fd6a7f..ae4fee2f 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -470,7 +470,7 @@ user_agent_parsers: family_replacement: 'Chrome Mobile WebView' - regex: '(CrMo)/(\d+)\.(\d+)\.(\d+)\.(\d+)' family_replacement: 'Chrome Mobile' - - regex: '(CriOS)/(\d+)\.(\d+)\.(\d+)\.(\d+)' + - regex: '(CriOS)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|)' family_replacement: 'Chrome Mobile iOS' - regex: '(Chrome)/(\d+)\.(\d+)\.(\d+)\.(\d+) Mobile(?:[ /]|$)' family_replacement: 'Chrome Mobile' diff --git a/tests/test_ua.yaml b/tests/test_ua.yaml index 1aa47902..d87d17be 100644 --- a/tests/test_ua.yaml +++ b/tests/test_ua.yaml @@ -8705,3 +8705,9 @@ test_cases: major: '108' minor: patch: + + - user_agent_string: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/102 Version/11.1.1 Safari/605.1.15' + family: 'Chrome Mobile iOS' + major: '102' + minor: + patch: