Skip to content

Commit

Permalink
fix: parse properly Chrome on iOS with request desktop (#559)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lbarthon authored Feb 21, 2024
1 parent f1a1ce0 commit 88e4cbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion regexes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 6 additions & 0 deletions tests/test_ua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

0 comments on commit 88e4cbc

Please sign in to comment.