From 3bfb24c8cbf7ed836f51c76b3aea9eda4a0b1fcc Mon Sep 17 00:00:00 2001 From: Ricardo Rauber Pereira Date: Fri, 5 Apr 2019 18:18:39 +0100 Subject: [PATCH] Updated the check for generic browsers --- src/parser-browsers.js | 5 +++-- test/acceptance/useragentstrings.yml | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/parser-browsers.js b/src/parser-browsers.js index a60d410..507ef54 100644 --- a/src/parser-browsers.js +++ b/src/parser-browsers.js @@ -590,9 +590,10 @@ const browsersList = [ { test: [/.*/i], describe(ua) { + const regexp = ua.search("\\(") == -1 ? /^(.*)\/(.*) / : /^(.*)\/(.*)\((.*) / return { - name: Utils.getFirstMatch(/^(.*)\/(.*)\((.*) /, ua), - version: Utils.getSecondMatch(/^(.*)\/(.*)\((.*) /, ua), + name: Utils.getFirstMatch(regexp, ua), + version: Utils.getSecondMatch(regexp, ua), }; }, }, diff --git a/test/acceptance/useragentstrings.yml b/test/acceptance/useragentstrings.yml index bf76b73..65af172 100644 --- a/test/acceptance/useragentstrings.yml +++ b/test/acceptance/useragentstrings.yml @@ -2216,6 +2216,15 @@ engine: name: "Blink" Generic: + - + ua: "Generic/2.15 libww" + spec: + browser: + name: "Generic" + version: "2.15" + os: {} + platform: {} + engine: {} - ua: "Generic/2.15 (Macintosh; Intel Mac OS X 10_6_8)" spec: