From c0a3e1d33ac7146a6112d9a3ed571567330a6f3a Mon Sep 17 00:00:00 2001 From: upstream Date: Fri, 4 Sep 2026 09:42:55 +0200 Subject: [PATCH] Upstream zzzprojects/html-agility-pack state of the touched files before cda2ad348b --- src/HtmlAgilityPack.Shared/HtmlEntity.cs | 3 +-- .../HtmlEntityDeEntitizeTests.cs | 25 ------------------- 2 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 src/Tests/HtmlAgilityPack.Tests.NetStandard2_0/HtmlEntityDeEntitizeTests.cs diff --git a/src/HtmlAgilityPack.Shared/HtmlEntity.cs b/src/HtmlAgilityPack.Shared/HtmlEntity.cs index 261701f..52cea1b 100644 --- a/src/HtmlAgilityPack.Shared/HtmlEntity.cs +++ b/src/HtmlAgilityPack.Shared/HtmlEntity.cs @@ -663,8 +663,7 @@ namespace HtmlAgilityPack } catch { - // 'e' already starts with '#', so prepending "&#" would duplicate it. - sb.Append("&" + e + ";"); + sb.Append("&#" + e + ";"); } } else diff --git a/src/Tests/HtmlAgilityPack.Tests.NetStandard2_0/HtmlEntityDeEntitizeTests.cs b/src/Tests/HtmlAgilityPack.Tests.NetStandard2_0/HtmlEntityDeEntitizeTests.cs deleted file mode 100644 index 52535c2..0000000 --- a/src/Tests/HtmlAgilityPack.Tests.NetStandard2_0/HtmlEntityDeEntitizeTests.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Xunit; - -namespace HtmlAgilityPack.Tests.NetStandard2_0 -{ - public class HtmlEntityDeEntitizeTests - { - [Theory] - // Invalid numeric entities must be left untouched; "&#foo;" used to become - // "&##foo;". - [InlineData("&#foo;", "&#foo;")] - [InlineData("&#xGG;", "&#xGG;")] - [InlineData("&#;", "&#;")] - [InlineData("prefix &#foo; suffix", "prefix &#foo; suffix")] - // Valid numeric entities keep decoding correctly. - [InlineData("A", "A")] - [InlineData("A", "A")] - // Named entities are unaffected. - [InlineData("&", "&")] - [InlineData("¬real;", "¬real;")] - public void DeEntitize_HandlesInvalidNumericEntitiesWithoutDuplicatingHash(string input, string expected) - { - Assert.Equal(expected, HtmlEntity.DeEntitize(input)); - } - } -}