Skip to content

Commit 3a0f5dd

Browse files
committed
fix: support UTF-8-SIG encoding from Discord attachments
1 parent d8c6e89 commit 3a0f5dd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

PasteMystBot/Services/MessagePastingService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ public async Task<bool> PasteMessageAttachmentsAsync(
140140

141141
foreach (DiscordAttachment attachment in message.Attachments)
142142
{
143-
string content = await _httpClient.GetStringAsync(attachment.Url).ConfigureAwait(false);
143+
await using Stream stream = await _httpClient.GetStreamAsync(attachment.Url).ConfigureAwait(false);
144+
using var reader = new StreamReader(stream);
145+
string content = await reader.ReadToEndAsync().ConfigureAwait(false);
144146
string title = attachment.FileName;
145147
var language = "Autodetect";
146148

0 commit comments

Comments
 (0)