diff --git a/src/parser-browsers.js b/src/parser-browsers.js index b1347db..6a8c28a 100644 --- a/src/parser-browsers.js +++ b/src/parser-browsers.js @@ -606,9 +606,17 @@ const browsersList = [ { test: [/.*/i], describe(ua) { + /* Here we try to make sure that there are explicit details about the device + * in order to decide what regexp exactly we want to apply + * (as there is a specific decision based on that conclusion) + */ + const regexpWithoutDeviceSpec = /^(.*)\/(.*) /; + const regexpWithDeviceSpec = /^(.*)\/(.*)[ \t]\((.*)/; + const hasDeviceSpec = ua.search('\\(') !== -1; + const regexp = hasDeviceSpec ? regexpWithDeviceSpec : regexpWithoutDeviceSpec; 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 50e97c4..0bf29f7 100644 --- a/test/acceptance/useragentstrings.yml +++ b/test/acceptance/useragentstrings.yml @@ -2269,6 +2269,19 @@ os: {} platform: {} engine: {} + - + ua: "Generic/2.15 (Macintosh; Intel Mac OS X 10_6_8)" + spec: + browser: + name: "Generic" + version: "2.15" + os: + name: "macOS" + version: "10.6.8" + platform: + type: "desktop" + vendor: "Apple" + engine: {} Googlebot: - ua: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"