mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
Fix organization_license not reading camelCase (#1832)
* Fix organization_license not reading camelCase * Fix formatting
This commit is contained in:
@ -21,15 +21,8 @@ namespace Bit.Api.Utilities
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var stream = file.OpenReadStream())
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
var s = await reader.ReadToEndAsync();
|
||||
if (!string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
obj = JsonSerializer.Deserialize<T>(s);
|
||||
}
|
||||
}
|
||||
using var stream = file.OpenReadStream();
|
||||
obj = await JsonSerializer.DeserializeAsync<T>(stream, JsonHelpers.IgnoreCase);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ namespace Bit.Core.Utilities
|
||||
{
|
||||
public static JsonSerializerOptions Default { get; }
|
||||
public static JsonSerializerOptions Indented { get; }
|
||||
public static JsonSerializerOptions IgnoreCase { get; }
|
||||
public static JsonSerializerOptions IgnoreWritingNull { get; }
|
||||
public static JsonSerializerOptions CamelCase { get; }
|
||||
public static JsonSerializerOptions IgnoreWritingNullAndCamelCase { get; }
|
||||
@ -22,6 +23,11 @@ namespace Bit.Core.Utilities
|
||||
WriteIndented = true,
|
||||
};
|
||||
|
||||
IgnoreCase = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
};
|
||||
|
||||
IgnoreWritingNull = new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
|
Reference in New Issue
Block a user