faisalman / ua-parser-js

"Unmask Your Traffic" - UAParser.js: The Essential Web Development Tool for User-Agent Detection
https://uaparser.dev/
GNU Affero General Public License v3.0
9.28k stars 1.2k forks source link

Apple Message’s link preview is categorized as very old Safari version #661

Closed analog-nico closed 1 year ago

analog-nico commented 1 year ago

Describe the bug When I paste link into the Apple Messages app then ua-parser-js thinks that the request is made by a very old Safari version.

To Reproduce Steps to reproduce the behavior:

  1. Open Apple Messages on Mac OS X Ventura
  2. Paste a link into a chat that is parsed by ua-parser-js on the server’s side

Or simply parse this UA: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.4 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.4 facebookexternalhit/1.1 Facebot Twitterbot/1.0

Actual behavior The above user agent is classified as a browser and says Safari version 9.0.1 although Mac OS X Ventura ships with Safari 16.4.

Expected behavior

Desktop (please complete the following information):

analog-nico commented 1 year ago

Sorry, I didn’t expect that Web Kit v601 actually is equivalent to Safari v9!

I was able to look it up in the Release History section here: https://en.wikipedia.org/wiki/Safari_version_history

So although it is debatable if this UA should really be classified as a browser – after all the UA contains all these bot names – it certainly tells the right Safari version.

I fixed the classification as a browser vs. bot by including the isbot library in my project as well. Both libraries together fit my use case.