digitalcrab / browscap_go

GoLang Library for Browser Capabilities Project
http://browscap.org/
MIT License
49 stars 27 forks source link

Possible problem with the scoring #6

Open harrineiman opened 7 years ago

harrineiman commented 7 years ago

Hi!

If I understand the code correctly, the scoring algorithm is just based on a line number and it will prefer smaller numbers, i.e. it seems to assume that more precise matches are higher up in the browscap.ini file.

This is not always the case - here's an example from the latest 6022 version with the user agent; Mozilla/5.0 (Linux; Android 6.0; Infinix HOT 4 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.132 Mobile Safari/537.36

The correct match (as it's returned from the browscap.org/ua-lookup page) would be: mozilla/5.0 (*linux*android?6.0*) applewebkit* (*khtml*like*gecko*) chrome/57.*safari/*

...but bgo finds this instead (the platform version is not matched): Mozilla/5.0 (*Linux*Android*) applewebkit* (*khtml*like*gecko*) Chrome/57.*Safari/*

It is also possible that I'm misunderstanding something, in which case I'm sorry for causing a fuss.

Cheers!

digitalcrab commented 7 years ago

Hello, thanks you for the information. I will take a look as soon as possible.

deepakdalakoti commented 7 years ago

Any updates on this? I am facing the same problem.

digitalcrab commented 7 years ago

Hello guys, sorry no updates for now. Hope next week I'll have more time.