Skip to content

Commit 34563cb

Browse files
Copilotgfs
andcommitted
Address code review: make sync non-indexed entry extraction pattern consistent with async
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
1 parent f252597 commit 34563cb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

RecursiveExtractor/Extractors/ZipExtractor.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ private IEnumerable<FileEntry> YieldNonIndexedEntries(
408408

409409
Logger.Info("Discovered non-indexed ZIP entry '{0}' in {1}", readerKey, parentEntry.FullPath);
410410

411-
Stream payload;
411+
Stream? payload = null;
412412
try
413413
{
414414
using var readerStream = forwardReader.OpenEntryStream();
@@ -419,9 +419,10 @@ private IEnumerable<FileEntry> YieldNonIndexedEntries(
419419
catch (Exception ex)
420420
{
421421
Logger.Debug(Extractor.FAILED_PARSING_ERROR_MESSAGE_STRING, ArchiveFileType.ZIP, parentEntry.FullPath, readerKey, ex.GetType());
422-
payload = new MemoryStream();
423422
}
424423

424+
payload ??= new MemoryStream();
425+
425426
var entryName = readerKey.Replace('/', Path.DirectorySeparatorChar);
426427
var discovered = new FileEntry(entryName, payload, parentEntry, memoryStreamCutoff: options.MemoryStreamCutoff)
427428
{

0 commit comments

Comments
 (0)