mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-15 21:14:32 +01:00
Fixed: In some cases MinVotes is int from v0.2, causes migration failure
This commit is contained in:
parent
c75362ecc8
commit
4ac18dd023
2 changed files with 28 additions and 0 deletions
26
src/NzbDrone.Core/Datastore/Converters/StringConverter.cs
Normal file
26
src/NzbDrone.Core/Datastore/Converters/StringConverter.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class StringConverter : JsonConverter<string>
|
||||
{
|
||||
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.Number)
|
||||
{
|
||||
var stringValue = reader.GetInt32();
|
||||
return stringValue.ToString();
|
||||
}
|
||||
else if (reader.TokenType == JsonTokenType.String)
|
||||
{
|
||||
return reader.GetString();
|
||||
}
|
||||
|
||||
throw new System.Text.Json.JsonException();
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(value);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,8 @@ public fix_tmdb_list_config()
|
|||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
_serializerSettings.Converters.Add(new StringConverter());
|
||||
}
|
||||
|
||||
protected override void MainDbUpgrade()
|
||||
|
|
|
|||
Loading…
Reference in a new issue