Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix client hints bug #7830

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Parser/Device/AbstractDeviceParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,7 @@ protected function buildModel(string $model, array $matches): string
*/
protected function parseClientHints(): ?array
{
if ($this->clientHints) {
if ($this->clientHints && $this->clientHints->getModel()) {
$deviceType = null;
$formFactors = $this->clientHints->getFormFactors();

Expand Down
23 changes: 23 additions & 0 deletions Tests/fixtures/clienthints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,29 @@
model: Explr 9
os_family: Android
browser_family: Chrome
-
user_agent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/21G93 [FBAN/FBIOS;FBAV/479.1.0.33.109;FBBV/637241220;FBDV/iPhone15,2;FBMD/iPhone;FBSN/iOS;FBSV/17.6.1;FBSS/3;FBID/phone;FBLC/es_ES;FBOP/5;FBRV/639094949;IABMV/1]'
headers:
Sec-CH-UA: ""
Sec-CH-UA-Platform: ""
Sec-CH-UA-Mobile: ""
Sec-CH-UA-Full-Version: ""
Sec-CH-UA-Platform-Version: ""
Sec-CH-UA-Model: ""
os:
name: iOS
version: 17.6.1
platform: ""
client:
type: mobile app
name: Facebook
version: 479.1.0.33.109
device:
type: phablet
brand: Apple
model: iPhone 14 Pro
os_family: iOS
browser_family: Unknown
-
user_agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.134 Safari/537.36 OPR/88.0.4412.53
headers:
Expand Down
Loading