From 13fdb4d7ca31d3d5d954cf6f39eef9d5b5989c51 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Sat, 14 Feb 2026 10:34:12 +0000 Subject: [PATCH] add better length from master --- src/SharpCompress/IO/SharpCompressStream.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/SharpCompress/IO/SharpCompressStream.cs b/src/SharpCompress/IO/SharpCompressStream.cs index b47b7031..a7c09072 100644 --- a/src/SharpCompress/IO/SharpCompressStream.cs +++ b/src/SharpCompress/IO/SharpCompressStream.cs @@ -206,8 +206,22 @@ internal partial class SharpCompressStream : Stream, IStreamStack throw new NotSupportedException(); } - public override long Length => - _isPassthrough ? stream.Length : throw new NotSupportedException(); + public override long Length + { + get + { + if (_isPassthrough) + { + return stream.Length; + } + + if (_ringBuffer is not null) + { + return _ringBuffer.Length; + } + throw new NotSupportedException(); + } + } public override long Position {