提交 8b7a624f 编写于 作者: M Mukul Sabharwal

Fix fallback encoding case; canBeEmbedded was not propogated

上级 44c86b89
......@@ -244,6 +244,17 @@ public void FromSource_Precomputed()
}
}
[Fact]
public void FromBytes_EncodingFallbackCase()
{
var source = EncodedStringText.Create(new MemoryStream(new byte[] { 0xA9, 0x0D, 0x0A }), canBeEmbedded: true);
var text = EmbeddedText.FromSource("pathToLarge", source);
Assert.Equal("pathToLarge", text.FilePath);
Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm);
AssertEx.Equal(source.GetChecksum(), text.Checksum);
}
private byte[] Decompress(IEnumerable<byte> bytes)
{
var destination = new MemoryStream();
......
......@@ -104,7 +104,7 @@ private static Encoding GetFallbackEncoding()
try
{
return Decode(stream, defaultEncoding ?? getEncoding.Value, checksumAlgorithm, throwIfBinaryDetected: detectEncoding);
return Decode(stream, defaultEncoding ?? getEncoding.Value, checksumAlgorithm, throwIfBinaryDetected: detectEncoding, canBeEmbedded: canBeEmbedded);
}
catch (DecoderFallbackException e)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册