mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
fix(apiv2): correctly parse timestamp in SwitchPatch
This commit is contained in:
parent
098d804344
commit
431f7e8931
2 changed files with 8 additions and 3 deletions
|
|
@ -163,11 +163,13 @@ namespace PluralKit.API
|
|||
if (!Guid.TryParse(switchRef, out var switchId))
|
||||
throw APIErrors.InvalidSwitchId;
|
||||
|
||||
var value = data.Value<Instant>("timestamp");
|
||||
if (value == null)
|
||||
var valueStr = data.Value<string>("timestamp").NullIfEmpty();
|
||||
if (valueStr == null)
|
||||
// todo
|
||||
throw APIErrors.GenericBadRequest;
|
||||
|
||||
var value = Instant.FromDateTimeOffset(DateTime.Parse(valueStr).ToUniversalTime());
|
||||
|
||||
var system = await ResolveSystem("@me");
|
||||
if (system == null)
|
||||
throw APIErrors.SystemNotFound;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue