mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-12 19:02:01 +01:00
Timespan in API should be parsed with invariant culture
This commit is contained in:
parent
daeeb58f71
commit
63a3667406
1 changed files with 2 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
using NBitcoin.JsonConverters;
|
using NBitcoin.JsonConverters;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ namespace BTCPayServer.Client.JsonConverters
|
||||||
return null;
|
return null;
|
||||||
return TimeSpan.Zero;
|
return TimeSpan.Zero;
|
||||||
}
|
}
|
||||||
if (reader.TokenType == JsonToken.String && TimeSpan.TryParse(reader.Value?.ToString(), out var res))
|
if (reader.TokenType == JsonToken.String && TimeSpan.TryParse(reader.Value?.ToString(), CultureInfo.InvariantCulture, out var res))
|
||||||
return res;
|
return res;
|
||||||
if (reader.TokenType != JsonToken.Integer)
|
if (reader.TokenType != JsonToken.Integer)
|
||||||
throw new JsonObjectException("Invalid timespan, expected integer", reader);
|
throw new JsonObjectException("Invalid timespan, expected integer", reader);
|
||||||
|
|
Loading…
Add table
Reference in a new issue