diff options
| author | Shadowghost <Shadowghost@users.noreply.github.com> | 2025-10-27 15:43:04 -0400 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2025-10-27 15:43:04 -0400 |
| commit | 9e53f46ad26b9ac815f12cdefa2ebfd41316d449 (patch) | |
| tree | 38fa74ed302631f3cf3a317ecc17f48b77af3e5c /Jellyfin.Server/Migrations | |
| parent | 53dfcae1a64671d39b889cf213fd736bbff402a4 (diff) | |
Backport pull request #15032 from jellyfin/release-10.11.z
Skip invalid keyframe cache data
Original-merge: f4a53209f4a3dde62acb7027d9b48eaa08d9ef8c
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Bond_009 <bond.009@outlook.com>
Diffstat (limited to 'Jellyfin.Server/Migrations')
| -rw-r--r-- | Jellyfin.Server/Migrations/Routines/MigrateKeyframeData.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/MigrateKeyframeData.cs b/Jellyfin.Server/Migrations/Routines/MigrateKeyframeData.cs index c199ee4d6..612da0521 100644 --- a/Jellyfin.Server/Migrations/Routines/MigrateKeyframeData.cs +++ b/Jellyfin.Server/Migrations/Routines/MigrateKeyframeData.cs @@ -135,14 +135,21 @@ public class MigrateKeyframeData : IDatabaseMigrationRoutine return Path.Join(keyframeCachePath, prefix, filename); } - private static bool TryReadFromCache(string? cachePath, [NotNullWhen(true)] out MediaEncoding.Keyframes.KeyframeData? cachedResult) + private bool TryReadFromCache(string? cachePath, [NotNullWhen(true)] out MediaEncoding.Keyframes.KeyframeData? cachedResult) { if (File.Exists(cachePath)) { - var bytes = File.ReadAllBytes(cachePath); - cachedResult = JsonSerializer.Deserialize<MediaEncoding.Keyframes.KeyframeData>(bytes, _jsonOptions); + try + { + var bytes = File.ReadAllBytes(cachePath); + cachedResult = JsonSerializer.Deserialize<MediaEncoding.Keyframes.KeyframeData>(bytes, _jsonOptions); - return cachedResult is not null; + return cachedResult is not null; + } + catch (JsonException jsonException) + { + _logger.LogWarning(jsonException, "Failed to read {Path}", cachePath); + } } cachedResult = null; |
