Skip to content

Commit fff8759

Browse files
committed
chore: linting
1 parent f9e5248 commit fff8759

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/Microsoft.OpenApi/Reader/OpenApiModelFactory.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,12 @@ private static async Task<MemoryStream> CopyToMemoryStreamAsync(Stream input, Ca
445445
{
446446
format ??= InspectStreamFormat(ms);
447447
}
448-
else if (!input.CanSeek)
448+
else if (!input.CanSeek || !TryInspectStreamFormat(input, out format!))
449449
{
450450
// Copy to a MemoryStream to enable seeking and perform format inspection
451451
var bufferStream = await CopyToMemoryStreamAsync(input, token).ConfigureAwait(false);
452452
return await PrepareStreamForReadingAsync(bufferStream, format, token).ConfigureAwait(false);
453453
}
454-
else if (!TryInspectStreamFormat(input, out format!))
455-
{
456-
var bufferStream = await CopyToMemoryStreamAsync(input, token).ConfigureAwait(false);
457-
return await PrepareStreamForReadingAsync(bufferStream, format, token).ConfigureAwait(false);
458-
}
459454

460455
return (preparedStream, format);
461456
}

0 commit comments

Comments
 (0)