Audit culture bugs (#7707)

* Added comments and fixed CultureInfo /  StringComparison where appropriate

* Addressed comments

* Fixed comment
This commit is contained in:
Avneet Kaur
2020-10-30 16:43:09 -07:00
committed by GitHub
parent bd34127cd4
commit 2c5b9b4d52
54 changed files with 160 additions and 28 deletions

View File

@@ -47,7 +47,10 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg.Utilities
var elements = doc.Descendants().ToList();
foreach (XElement element in elements)
{
var elementName = element?.Name?.LocalName?.ToLower(CultureInfo.CurrentCulture);
// Using Invariant since we are doing an exact match for HTML tags and we want it to behave the same in every culture
#pragma warning disable CA1308 // Normalize strings to uppercase
var elementName = element?.Name?.LocalName?.ToLowerInvariant();
#pragma warning restore CA1308 // Normalize strings to uppercase
if (elementName != null && blockedElementsName.ContainsKey(elementName))
{
foundBlockedElement = true;