Skip to content

Commit e6d2511

Browse files
mitchcapperTrolldemorted
authored andcommitted
Allow reading the total size of the two attachment stream types since .ToArray() is removed
1 parent 45a45e8 commit e6d2511

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

libsignal-service-dotnet/crypto/AttachmentCipherInputStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class AttachmentCipherInputStream : Stream
2828
public override bool CanRead => true;
2929
public override bool CanSeek => false;
3030
public override bool CanWrite => false;
31-
public override long Length => throw new NotImplementedException();
31+
public override long Length => TotalDataSize;
3232
public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
3333

3434
public static Stream CreateFor(Stream inputStream, long plaintextLength, byte[] combinedKeyMaterial, byte[] digest)

libsignal-service-dotnet/util/ContentLengthInputStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ internal class ContentLengthInputStream : Stream
99
{
1010
private readonly Stream InputStream;
1111
private long BytesRemaining;
12-
12+
private readonly long TotalDataSize;
1313
public override bool CanRead => true;
1414
public override bool CanSeek => false;
1515
public override bool CanWrite => false;
16-
public override long Length => throw new NotImplementedException();
16+
public override long Length => TotalDataSize;
1717
public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
1818

1919
public ContentLengthInputStream(Stream inputStream, long contentLength)
2020
{
2121
InputStream = inputStream;
22-
BytesRemaining = contentLength;
22+
TotalDataSize=BytesRemaining = contentLength;
2323
}
2424

2525
public override void Flush()

0 commit comments

Comments
 (0)