diff --git a/PluralKit.Bot/Commands/ImportExport.cs b/PluralKit.Bot/Commands/ImportExport.cs index 2d4197a7..f189c8f7 100644 --- a/PluralKit.Bot/Commands/ImportExport.cs +++ b/PluralKit.Bot/Commands/ImportExport.cs @@ -33,10 +33,10 @@ public class ImportExport public async Task Import(Context ctx) { - var url = ctx.RemainderOrNull() ?? ctx.Message.Attachments.FirstOrDefault()?.Url; - if (url == null) throw Errors.NoImportFilePassed; + var inputUrl = ctx.RemainderOrNull() ?? ctx.Message.Attachments.FirstOrDefault()?.Url; + if (inputUrl == null) throw Errors.NoImportFilePassed; - if (!Core.MiscUtils.TryMatchUri(url, out var _)) + if (!Core.MiscUtils.TryMatchUri(inputUrl, out var url)) throw Errors.InvalidUrl; await ctx.BusyIndicator(async () => diff --git a/PluralKit.Core/Utils/MiscUtils.cs b/PluralKit.Core/Utils/MiscUtils.cs index d0de0355..366deb6b 100644 --- a/PluralKit.Core/Utils/MiscUtils.cs +++ b/PluralKit.Core/Utils/MiscUtils.cs @@ -13,6 +13,9 @@ public static class MiscUtils public static bool TryMatchUri(string input, out Uri uri) { + if (input.StartsWith('<') && input.EndsWith('>')) + input = input[1..^1]; + try { uri = new Uri(input);