Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Native AOT: don't load SentryNative on unsupported platforms ([#4347](https://github.com/getsentry/sentry-dotnet/pull/4347))
- Fixed issue introduced in release 5.12.0 that might prevent other middleware or user code from reading request bodies ([#4373](https://github.com/getsentry/sentry-dotnet/pull/4373))

### Dependencies

Expand Down
12 changes: 4 additions & 8 deletions src/Sentry/Extensibility/BaseRequestPayloadExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@ public abstract class BaseRequestPayloadExtractor : IRequestPayloadExtractor
return null;
}

if (request.Body is not { CanRead: true } || !IsSupported(request))
if (request.Body == null
|| !request.Body.CanSeek
|| !request.Body.CanRead
|| !IsSupported(request))
{
return null;
}

if (!request.Body.CanSeek)
{
// When RequestDecompression is enabled, the RequestDecompressionMiddleware will store a SizeLimitedStream
// in the request body after decompression. Seek operations throw an exception, but we can still read the stream
return DoExtractPayLoad(request);
}

var originalPosition = request.Body.Position;
try
{
Expand Down
Loading