podigee/device_detector

Android 9 user agents get nil as os_full_version

Closed this issue · 2 comments

Now that android 9 is live, the user agents we get from those devices look something like this:

Mozilla/5.0 (Linux; Android 9; Pixel 2 XL Build/PPP3.180510.008; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Mobile Safari/537.36
                            ^
                            This is where we should see something like 9.0 instead

(as seen here)

Because the regexp for android devices expects a version number like
(\d+[\.\d]+) The lone 9 is just not picked up.

You can reproduce it like this:

dd = DeviceDetector.new "Mozilla/5.0 (Linux; Android 9; Pixel 2 Build/PPR1.180610.009) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36"
dd.os_full_version # => nil

Seeing the same issue as well, fwiw

Fixed via 365ddc7