Skip to content

Commit d2f8e6e

Browse files
authored
Merge pull request #181 from octokit/encoding-ampersands-too
Being sure to encode ampersands
2 parents e2ad352 + c87615d commit d2f8e6e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Octokit.GraphQL.Core.Generation.UnitTests/EntityGenerationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ public void Generates_Doc_Comments_For_Property()
16361636
public void Generates_Doc_Comments_For_Property_With_XmlCharacters()
16371637
{
16381638
var expected = FormatMemberTemplate(@"/// <summary>
1639-
/// Testing if doc comments are generated &lt;http://localhost&gt;.
1639+
/// Testing if doc comments &amp; generated &lt;http://localhost&gt;.
16401640
/// </summary>
16411641
public Other Foo => this.CreateProperty(x => x.Foo, Test.Other.Create);");
16421642

@@ -1649,7 +1649,7 @@ public void Generates_Doc_Comments_For_Property_With_XmlCharacters()
16491649
new FieldModel
16501650
{
16511651
Name = "Foo",
1652-
Description = "Testing if doc comments are generated <http://localhost>.",
1652+
Description = "Testing if doc comments & generated <http://localhost>.",
16531653
Type = TypeModel.Object("Other")
16541654
},
16551655
}

Octokit.GraphQL.Core.Generation/DocCommentGenerator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Text;
3+
using System.Xml;
34

45
namespace Octokit.GraphQL.Core.Generation
56
{
@@ -20,7 +21,7 @@ public static void GenerateSummary(string summary, int indentation, StringBuilde
2021

2122
private static void GenerateCommentBlock(string text, string indent, StringBuilder builder)
2223
{
23-
text = text.Replace("<", "&lt;").Replace(">", "&gt;");
24+
text = text.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");
2425

2526
foreach (var line in text.Split('\r', '\n'))
2627
{

0 commit comments

Comments
 (0)