Fix trimming line if CR not directly before LF (#1006)
If the line contains a CR in any location than directly before the LF it would detect a valid line and then trim 2 characters from the end of the line, losing a "real" character.
This commit is contained in:
parent
f3ac1fac0c
commit
f6f89554c9
|
|
@ -327,21 +327,12 @@ namespace Microsoft.AspNetCore.WebUtilities
|
|||
builder.WriteByte(b);
|
||||
_bufferOffset++;
|
||||
_bufferCount--;
|
||||
if (b == CR)
|
||||
if (b == LF && foundCR)
|
||||
{
|
||||
foundCR = true;
|
||||
}
|
||||
else if (b == LF)
|
||||
{
|
||||
if (foundCR)
|
||||
{
|
||||
foundCRLF = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foundCR = false;
|
||||
}
|
||||
foundCRLF = true;
|
||||
return;
|
||||
}
|
||||
foundCR = b == CR;
|
||||
}
|
||||
|
||||
private string DecodeLine(MemoryStream builder, bool foundCRLF)
|
||||
|
|
|
|||
Loading…
Reference in New Issue