-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paris Morgan
committed
Oct 4, 2021
1 parent
79535f5
commit 343d584
Showing
1 changed file
with
2 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
343d584
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackpoll
This (updated) pattern results in a false positive when user agent string contains the string "quest", e.g.
python-requests/2.24.0
, causing this to be incorrectly categorised a an Oculus Quest wearable.(regex 1) A likely better pattern would be
/\;\s?(Quest\s?\d{0,})/i
as it takes into account future versions as well + doesn't result in the false positive as pattern matches;quest
and; quest 2
and; quest 23
and;quest 12345
but NOTrequest
orconquest
or similar (i flag if you want it to be case insensitive)(regex 2) Alternatively (and likely slightly better), if you don't want it to match
; Quest234
, this pattern will do:/\;\s?(Quest\s\d{0,}|Quest)/i
Thoughts/reflections: Technically, the pattern should only be matching if the string contains both "quest" and "oculus", right? Something like
/(quest.*?)\).*?oculus.*/i
UA strings I've tested against using both the first and second regex:
Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/16.6.0.1.52.314146309 SamsungBrowser/4.0 Chrome/91.0.4472.164 Safari/537.36
- MATCHMozilla/5.0 (X11; Linux x86_64; Quest) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/16.6.0.1.52.314146309 SamsungBrowser/4.0 Chrome/91.0.4472.164 Safari/537.36
- MATCHMozilla/5.0 (X11; Linux x86_64; Quest 23) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/16.6.0.1.52.314146309 SamsungBrowser/4.0 Chrome/91.0.4472.164 Safari/537.36
- MATCHMozilla/5.0 (X11; Linux x86_64;Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/16.6.0.1.52.314146309 SamsungBrowser/4.0 Chrome/91.0.4472.164 Safari/537.36
- MATCHMozilla/5.0 (X11; Linux x86_64;Quest) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/16.6.0.1.52.314146309 SamsungBrowser/4.0 Chrome/91.0.4472.164 Safari/537.36
- MATCHMozilla/5.0 (X11; Linux x86_64;Quest 23) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/16.6.0.1.52.314146309 SamsungBrowser/4.0 Chrome/91.0.4472.164 Safari/537.36
- MATCHMozilla/5.0 (X11; Linux x86_64;Quest23) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/16.6.0.1.52.314146309 SamsungBrowser/4.0 Chrome/91.0.4472.164 Safari/537.36
- MATCH with regex 1 / NO MATCH with regex 2python-requests/2.24.0
- NO MATCHOn a side note, I haven't yet figured out how I can override the built-in pattern. If I use the extend feature to add a "device" pattern for the
python-requests/2.24.0
UA string, the "Oculus Quest" pattern still takes effect (overrides my pattern).