From acf138c8fbe9dbbc64422bbb56879a37efc17e71 Mon Sep 17 00:00:00 2001 From: jahorton Date: Wed, 27 Nov 2019 11:49:40 +0700 Subject: [PATCH] fix(web): Fixes #2379. Allows '.' in macOS version strings --- web/source/kmwdevice.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/source/kmwdevice.ts b/web/source/kmwdevice.ts index e08eab92f4..fba765c92b 100644 --- a/web/source/kmwdevice.ts +++ b/web/source/kmwdevice.ts @@ -74,7 +74,10 @@ namespace com.keyman { // Starting with 13.1, "Macintosh" can reflect iPads (by default) or iPhones // (by user setting); a new "Request Desktop Website" setting for Safari will // change the user agent string to match a desktop Mac. - let regex = /Intel Mac OS X (10(?:_\d+)+)/i; + // + // Firefox uses '.' between version components, while Chrome and Safari use + // '_' instead. So, we have to check for both. Yay. + let regex = /Intel Mac OS X (10(?:[_\.]\d+)+)/i; let results = regex.exec(agent); // Match result: a version string with components separated by underscores.