Skip to content

Commit

Permalink
fix: parse Chrome and Edge mobile on iOS as iOS, even with desktop mo…
Browse files Browse the repository at this point in the history
…de on

The desktop mode on both those applications changes the user-agent, making it
say that the device runs Mac OS X. However, this still runs on iOS, and should
be parsed as is.
  • Loading branch information
lbarthon committed May 31, 2024
1 parent cd52910 commit 1f6353a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions regexes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,10 @@ os_parsers:
##########
- regex: '(Tizen)[/ ](\d+)\.(\d+)'

# Chrome and Edge on iOS with desktop mode contains Mac OS X, so it must be before any Mac OS check
- regex: 'Intel Mac OS X.+(CriOS|EdgiOS)/\d+'
os_replacement: 'iOS'

##########
# Mac OS
# @ref: http://en.wikipedia.org/wiki/Mac_OS_X#Versions
Expand Down
14 changes: 14 additions & 0 deletions tests/test_os.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2762,6 +2762,20 @@ test_cases:
patch: '3'
patch_minor:

- 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: 'iOS'
major:
minor:
patch:
patch_minor:

- user_agent_string: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) EdgiOS/125 Version/13.0.3 Safari/605.1.15'
family: 'iOS'
major:
minor:
patch:
patch_minor:

- user_agent_string: 'Mozilla/5.0 (iPhone; CPU IPhone OS 9_2_1 Like Mac OS X) AppleWebKit/601.1.46 (KHTML, Like Gecko) Mobile/13D15 [FBAN/FBIOS;FBAV/52.0.0.46.157;FBBV/26424168;FBDV/iPhone6,2;FBMD/iPhone;FBSN/iPhone OS;FBSV/9.2.1;FBSS/2; FBCR/Globe;FBID/phone;FBLC/en_US;FBOP/5]'
family: 'iOS'
major: '9'
Expand Down

0 comments on commit 1f6353a

Please sign in to comment.