From 5b5131fc65c1d4f3c71dfaed127816d336306c65 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 1 Apr 2025 21:52:39 +0200 Subject: [PATCH 1/2] fix: attachments transport --- modules/Sentry/private/SynchronousTransport.ps1 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/Sentry/private/SynchronousTransport.ps1 b/modules/Sentry/private/SynchronousTransport.ps1 index 0f3528b..c5f19c5 100644 --- a/modules/Sentry/private/SynchronousTransport.ps1 +++ b/modules/Sentry/private/SynchronousTransport.ps1 @@ -11,7 +11,8 @@ class SynchronousTransport : Sentry.Http.HttpTransportBase, Sentry.Extensibility SynchronousTransport([Sentry.SentryOptions] $options) : base($options) { $this.logger = $options.DiagnosticLogger - if ($null -eq $this.logger) { + if ($null -eq $this.logger) + { $this.logger = Get-Variable -Scope script -Name SentryPowerShellDiagnosticLogger -ValueOnly -ErrorAction SilentlyContinue } @@ -42,16 +43,13 @@ class SynchronousTransport : Sentry.Http.HttpTransportBase, Sentry.Extensibility $this.SerializeToStream.Invoke($request.Content, @($memoryStream, $null, $cancellationToken)) $memoryStream.Position = 0 - $reader = New-Object System.IO.StreamReader($memoryStream) - $content = $reader.ReadToEnd() - $reader.Close() - - if ($null -ne $this.logger) { - $this.logger.Log([Sentry.SentryLevel]::Debug, 'Sending content synchronously, Content-Length: {0}', $null, $content.Length) + if ($null -ne $this.logger) + { + $this.logger.Log([Sentry.SentryLevel]::Debug, 'Sending content synchronously, Content-Length: {0}', $null, $memoryStream.Length) } $ProgressPreference = 'SilentlyContinue' - $psResponse = Invoke-WebRequest -Uri $request.RequestUri -Method $request.Method.Method -Headers $headers -Body $content -UseBasicParsing + $psResponse = Invoke-WebRequest -Uri $request.RequestUri -Method $request.Method.Method -Headers $headers -Body $memoryStream -UseBasicParsing $response = [System.Net.Http.HttpResponseMessage]::new($psResponse.StatusCode) $contentType = $psResponse.Headers['Content-Type'] From 0cbddfa2f262e4b1f6c28671012fa58dd569d6d5 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 1 Apr 2025 21:54:13 +0200 Subject: [PATCH 2/2] chore: changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd2fa4..032e691 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - Drop support for PowerShell 7.2 and 7.3 ([#71](https://github.com/getsentry/sentry-powershell/pull/71)) +### Fixes + +- Attachments support regression introduced in v0.2.0 ([#80](https://github.com/getsentry/sentry-powershell/pull/80)) + ### Features - Add support for PowerShell 7.5 ([#76](https://github.com/getsentry/sentry-powershell/pull/76))