Timespan in API should be parsed with invariant culture

This commit is contained in:
nicolas.dorier 2024-07-11 21:40:44 +09:00
parent 25ae6df095
commit 66d8dda0f5
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE

View File

@ -1,4 +1,5 @@
using System;
using System.Globalization;
using NBitcoin.JsonConverters;
using Newtonsoft.Json;
@ -58,7 +59,7 @@ namespace BTCPayServer.Client.JsonConverters
return null;
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;
if (reader.TokenType != JsonToken.Integer)
throw new JsonObjectException("Invalid timespan, expected integer", reader);