mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Handle IO errors in LoadManifest
This commit is contained in:
parent
1ea2b200c0
commit
1fdd2d6e05
@ -512,30 +512,36 @@ namespace Emby.Server.Implementations.Plugins
|
|||||||
var metafile = Path.Combine(dir, "meta.json");
|
var metafile = Path.Combine(dir, "meta.json");
|
||||||
if (File.Exists(metafile))
|
if (File.Exists(metafile))
|
||||||
{
|
{
|
||||||
|
// Only path where this stays null is when File.ReadAllBytes throws an IOException
|
||||||
|
byte[] data = null!;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = File.ReadAllBytes(metafile);
|
data = File.ReadAllBytes(metafile);
|
||||||
manifest = JsonSerializer.Deserialize<PluginManifest>(data, _jsonOptions);
|
manifest = JsonSerializer.Deserialize<PluginManifest>(data, _jsonOptions);
|
||||||
}
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error reading file {Path}.", dir);
|
||||||
|
}
|
||||||
catch (JsonException ex)
|
catch (JsonException ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error deserializing {Path}.", dir);
|
_logger.LogError(ex, "Error deserializing {Json}.", Encoding.UTF8.GetString(data!));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (manifest != null)
|
if (manifest != null)
|
||||||
{
|
|
||||||
if (!Version.TryParse(manifest.TargetAbi, out var targetAbi))
|
|
||||||
{
|
{
|
||||||
targetAbi = _minimumVersion;
|
if (!Version.TryParse(manifest.TargetAbi, out var targetAbi))
|
||||||
}
|
{
|
||||||
|
targetAbi = _minimumVersion;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Version.TryParse(manifest.Version, out version))
|
if (!Version.TryParse(manifest.Version, out version))
|
||||||
{
|
{
|
||||||
manifest.Version = _minimumVersion.ToString();
|
manifest.Version = _minimumVersion.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LocalPlugin(dir, _appVersion >= targetAbi, manifest);
|
return new LocalPlugin(dir, _appVersion >= targetAbi, manifest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No metafile, so lets see if the folder is versioned.
|
// No metafile, so lets see if the folder is versioned.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user