fix(bot): ignore charset from discord cdn for export files

This commit is contained in:
spiral 2023-03-11 17:45:22 -05:00
parent f58ada7fac
commit f6a9d693cd

View File

@ -47,6 +47,9 @@ public class ImportExport
var response = await _client.GetAsync(url); var response = await _client.GetAsync(url);
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
throw Errors.InvalidImportFile; 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<JObject>( data = JsonConvert.DeserializeObject<JObject>(
await response.Content.ReadAsStringAsync(), await response.Content.ReadAsStringAsync(),
_settings _settings