mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-30 12:28:27 +01:00
Merge pull request #4730 from crobibero/base-item-dto-guid-nullable
Don't serialize empty GUID to null
(cherry picked from commit b6ecaccf92)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
committed by
Joshua M. Boniface
parent
11a37884f0
commit
aae90a8480
@@ -13,21 +13,13 @@ namespace MediaBrowser.Common.Json.Converters
|
||||
public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
var guidStr = reader.GetString();
|
||||
|
||||
return guidStr == null ? Guid.Empty : new Guid(guidStr);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options)
|
||||
{
|
||||
if (value == Guid.Empty)
|
||||
{
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStringValue(value);
|
||||
}
|
||||
writer.WriteStringValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user