faisalman / ua-parser-js

UAParser.js - The Essential Web Development Tool for User-Agent Detection.
https://uaparser.dev/
GNU Affero General Public License v3.0
9.1k stars 1.19k forks source link

SONY Xperia (A10"n"SO) device’s chrome browser detected as acer tablet #578

Closed RyotaSugawara closed 2 years ago

RyotaSugawara commented 2 years ago

Hi, I found parser bug that happens in the SONY Xperia (A10"n"SO) device’s browser returns a wrong device info. (device like A101SO, A102SO, A103SO)

This commit seems to fix it and test is working well, but it returns wrong device info (as acer tablet) at http://faisalman.github.io/ua-parser-js/ and https://npm.runkit.com/ua-parser-js.

UserAgent patterns

Mozilla/5.0 (Linux; Android 11; A101SO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 12; A103SO) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/95.0.4638.74 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 12; A103SO Build/61.1.E.0.341; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/95.0.4638.74 Mobile Safari/537.36

Expect

// new UAParser().getDevice()
{
  "vendor": "SONY",
  "model": "A101SO", // A102SO, A103SO
  "type": "mobile"
}

Actual

// new UAParser().getDevice()
{
  "vendor": "Acer",
  "model": "A101", // A102, A103
  "type": "tablet"
}
faisalman commented 2 years ago

Hi thanks for reporting this issue, it has been fixed in this commit: https://github.com/faisalman/ua-parser-js/commit/23ad60ea689e2d25ec9e403bf128d3b974c341cb and should be included in next publish.

RyotaSugawara commented 2 years ago

Thank you for bug fix!