fix: Parse Crosswalk UA as Android not ChromeOS (#1024)#1572
Merged
davidism merged 2 commits intopallets:masterfrom Jun 1, 2019
Merged
fix: Parse Crosswalk UA as Android not ChromeOS (#1024)#1572davidism merged 2 commits intopallets:masterfrom
davidism merged 2 commits intopallets:masterfrom
Conversation
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #1024, it was shown that when using the Crosswalk Webview, the user agent parsing in Werkzeug would categorize
CrosswalkasChromeOSrather thanAndroidalthough it was running on Android.This occurred as we rely on matching
crosanywhere in the UA string to determine if a UA is fromChromeOS. Upon reviewingChromeOSUA strings, it became clear thatCrOSis always surrounded by a space on either side. As such, this change makes us check forcrosinstead ofcrosand adds test coverage for this case.It should be noted that on #1024, @alexpantyukhin proposes ensuring we check all strings as separate words (e.g. expecting a space on either side or the beginning or end of line). This may be reasonable but I'm unclear of how it might affect parsing other UA strings that aren't covered in the test cases.