From f6a9d693cd583fd795b98ba5450ba60cd292f74d Mon Sep 17 00:00:00 2001 From: spiral Date: Sat, 11 Mar 2023 17:45:22 -0500 Subject: [PATCH] fix(bot): ignore charset from discord cdn for export files --- PluralKit.Bot/Commands/ImportExport.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PluralKit.Bot/Commands/ImportExport.cs b/PluralKit.Bot/Commands/ImportExport.cs index f189c8f7..99b3e680 100644 --- a/PluralKit.Bot/Commands/ImportExport.cs +++ b/PluralKit.Bot/Commands/ImportExport.cs @@ -47,6 +47,9 @@ public class ImportExport var response = await _client.GetAsync(url); if (!response.IsSuccessStatusCode) throw Errors.InvalidImportFile; + // hacky fix for discord api returning nonsense charsets sometimes + response.Content.Headers.Remove("content-type"); + response.Content.Headers.Add("content-type", "application/json; charset=UTF-8"); data = JsonConvert.DeserializeObject( await response.Content.ReadAsStringAsync(), _settings