Allow de-embedding image links with <>

This commit is contained in:
Ske 2020-07-07 23:52:54 +02:00
parent 8d01b580e2
commit 17fbdf553c

View File

@ -30,6 +30,10 @@ namespace PluralKit.Bot
var arg = ctx.RemainderOrNull(); var arg = ctx.RemainderOrNull();
if (arg != null) if (arg != null)
{ {
// Allow surrounding the URL with <angle brackets> to "de-embed"
if (arg.StartsWith("<") && arg.EndsWith(">"))
arg = arg.Substring(1, arg.Length - 2);
if (!Uri.TryCreate(arg, UriKind.Absolute, out var uri)) if (!Uri.TryCreate(arg, UriKind.Absolute, out var uri))
throw Errors.InvalidUrl(arg); throw Errors.InvalidUrl(arg);