mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat: refactor external input handling code
- refactor import/export code - make import/export use the same JSON parsing as API - make Patch.AssertIsValid actually useful
This commit is contained in:
parent
f912805ecc
commit
4b944e2b20
18 changed files with 619 additions and 694 deletions
|
|
@ -31,14 +31,14 @@ namespace PluralKit.Core
|
|||
.With("list_privacy", ListPrivacy)
|
||||
.With("visibility", Visibility);
|
||||
|
||||
public new void CheckIsValid()
|
||||
public new void AssertIsValid()
|
||||
{
|
||||
if (Icon.Value != null && !MiscUtils.TryMatchUri(Icon.Value, out var avatarUri))
|
||||
throw new InvalidPatchException("icon");
|
||||
throw new ValidationError("icon");
|
||||
if (BannerImage.Value != null && !MiscUtils.TryMatchUri(BannerImage.Value, out var bannerImage))
|
||||
throw new InvalidPatchException("banner");
|
||||
throw new ValidationError("banner");
|
||||
if (Color.Value != null && (!Regex.IsMatch(Color.Value, "^[0-9a-fA-F]{6}$")))
|
||||
throw new InvalidPatchException("color");
|
||||
throw new ValidationError("color");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue