Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Microsoft.Identity.Web/CookiePolicyOptionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,13 @@ bool IsChromiumVersionAtLeast(int major)

// Extract digits from first capturing group.
Match match = Regex.Match(userAgent, regex);
int version = Convert.ToInt32(match.Groups[1].Value, CultureInfo.CurrentCulture);
return version >= major;
if (!match.Success)
return false;

if (int.TryParse(match.Groups[1].Value, out int version))
return version >= major;

return false;
}

bool IsUcBrowser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void HandleSameSiteCookieCompatibility_CustomFilter_ExecutesSuccessfully(
}

[Theory]
[InlineData(false, "Dalvik / 2.1.0(Linux; U; Android 12; Chromecast Build / STTE.230319.008.H1)")]
[InlineData(true, "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148")]
[InlineData(true, "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1")]
[InlineData(true, "Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148")]
Expand Down