mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
API patch improvements
- add PatchObject.CheckIsValid - use transaction when creating member, as to not create a member if the patch is invalid - return edited system in `PATCH /s` endpoint
This commit is contained in:
parent
a2d2036851
commit
b34ed5c4c0
10 changed files with 103 additions and 22 deletions
24
PluralKit.Core/Utils/MiscUtils.cs
Normal file
24
PluralKit.Core/Utils/MiscUtils.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
|
||||
namespace PluralKit.Core
|
||||
{
|
||||
public static class MiscUtils
|
||||
{
|
||||
public static bool TryMatchUri(string input, out Uri uri)
|
||||
{
|
||||
try
|
||||
{
|
||||
uri = new Uri(input);
|
||||
if (!uri.IsAbsoluteUri || (uri.Scheme != "http" && uri.Scheme != "https"))
|
||||
return false;
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
uri = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue