mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 07:47:53 +00:00
fix(bot): validate url in pk;import
This commit is contained in:
parent
ac5774df3d
commit
2fea773d7e
4 changed files with 7 additions and 7 deletions
|
|
@ -23,11 +23,8 @@ public static class ContextAvatarExt
|
|||
if (arg.StartsWith("<") && arg.EndsWith(">"))
|
||||
arg = arg.Substring(1, arg.Length - 2);
|
||||
|
||||
if (!Uri.TryCreate(arg, UriKind.Absolute, out var uri))
|
||||
throw Errors.InvalidUrl(arg);
|
||||
|
||||
if (uri.Scheme != "http" && uri.Scheme != "https")
|
||||
throw Errors.InvalidUrl(arg);
|
||||
if (!Core.MiscUtils.TryMatchUri(arg, out var uri))
|
||||
throw Errors.InvalidUrl;
|
||||
|
||||
// ToString URL-decodes, which breaks URLs to spaces; AbsoluteUri doesn't
|
||||
return new ParsedImage { Url = uri.AbsoluteUri, Source = AvatarSource.Url };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue