Skip to content

Commit

Permalink
Added block string handling back to the UTF8 helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Sep 1, 2023
1 parent 19406aa commit de63bd0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/HotChocolate/Language/src/Language.Utf8/Utf8Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,22 @@ public static void Unescape(
{
code = escapedString[++readPosition];

if (code.IsValidEscapeCharacter())
if (isBlockString && code == GraphQLConstants.Quote)
{
if (escapedString[readPosition + 1] == GraphQLConstants.Quote
&& escapedString[readPosition + 2] == GraphQLConstants.Quote)
{
readPosition += 2;
unescapedString[writePosition++] = GraphQLConstants.Quote;
unescapedString[writePosition++] = GraphQLConstants.Quote;
unescapedString[writePosition++] = GraphQLConstants.Quote;
}
else
{
throw new Utf8EncodingException(Utf8Helper_InvalidQuoteEscapeCount);
}
}
else if (code.IsValidEscapeCharacter())
{
if (code == GraphQLConstants.U)
{
Expand Down Expand Up @@ -137,4 +152,4 @@ private static int HexToDecimal(int a)
_ => -1
};
}
}
}

0 comments on commit de63bd0

Please sign in to comment.