browser icon indicating copy to clipboard operation
browser copied to clipboard

support lowercase user agent

Open YegorZdanovich opened this issue 3 years ago • 0 comments

Hi, I have table with unique user agents. I store them as lowercased values. I wanted to do some analyses based on my data, but figure out that gem doesn't detected browser correct.

Browser.new("mozilla/5.0 (windows nt 10.0; win64; x64; rv:52.0) gecko/20100101 firefox/52.0").name
 => "Generic Browser"

then i checked logic detection and found that in most matchers strings are compared case sensitive https://github.com/fnando/browser/blob/main/lib/browser/firefox.rb#L18

So, when i changed one symbol it works as expected.

Browser.new("mozilla/5.0 (windows nt 10.0; win64; x64; rv:52.0) gecko/20100101 Firefox/52.0").name
 => "Firefox"

So, is it possible to add lowercase string support? Basically, if you compare strings above - it's same browser, but we have different results.

Software:

  • Rails Version: "6.0.3.2"

  • Browser gem version: "2.5.1"

YegorZdanovich avatar Mar 17 '21 14:03 YegorZdanovich