Autocorrect invalid JSON for flag importing

This commit is contained in:
pizzaboxer 2023-10-25 14:26:23 +01:00
parent 951252d8fe
commit 7759ab1212
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8

View File

@ -245,7 +245,14 @@ namespace Bloxstrap.UI.Elements.Menu.Pages
if (dialog.Result != MessageBoxResult.OK)
return;
json = dialog.JsonTextBox.Text;
json = dialog.JsonTextBox.Text.Trim();
// autocorrect where possible
if (!json.StartsWith('{'))
json = '{' + json;
if (!json.EndsWith('}'))
json += '}';
try
{