mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-08 18:54:26 -04:00
Merge pull request #4735 from crobibero/json-recursion
Fix JsonConverter recursion (cherry picked from commit 94d805d03d93764365c5b63e23f239d47d23ad0a) Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
parent
24e4fcc3b7
commit
126753a1fe
@ -342,10 +342,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||||||
|
|
||||||
public string URL { get; set; }
|
public string URL { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(JsonBoolNumberConverter))]
|
|
||||||
public bool Favorite { get; set; }
|
public bool Favorite { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(JsonBoolNumberConverter))]
|
|
||||||
public bool DRM { get; set; }
|
public bool DRM { get; set; }
|
||||||
|
|
||||||
public int HD { get; set; }
|
public int HD { get; set; }
|
||||||
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Common.Json.Converters
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options)
|
public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options)
|
||||||
{
|
{
|
||||||
JsonSerializer.Serialize(writer, value, options);
|
writer.WriteBooleanValue(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,5 +19,16 @@ namespace Jellyfin.Common.Tests.Json
|
|||||||
var value = JsonSerializer.Deserialize<bool>(input, options);
|
var value = JsonSerializer.Deserialize<bool>(input, options);
|
||||||
Assert.Equal(value, output);
|
Assert.Equal(value, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(true, "true")]
|
||||||
|
[InlineData(false, "false")]
|
||||||
|
public static void Serialize_Bool_Success(bool input, string output)
|
||||||
|
{
|
||||||
|
var options = new JsonSerializerOptions();
|
||||||
|
options.Converters.Add(new JsonBoolNumberConverter());
|
||||||
|
var value = JsonSerializer.Serialize(input, options);
|
||||||
|
Assert.Equal(value, output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user