Handle IO errors in LoadManifest
This commit is contained in:
parent
1ea2b200c0
commit
1fdd2d6e05
|
@ -512,15 +512,20 @@ namespace Emby.Server.Implementations.Plugins
|
|||
var metafile = Path.Combine(dir, "meta.json");
|
||||
if (File.Exists(metafile))
|
||||
{
|
||||
// Only path where this stays null is when File.ReadAllBytes throws an IOException
|
||||
byte[] data = null!;
|
||||
try
|
||||
{
|
||||
var data = File.ReadAllBytes(metafile);
|
||||
data = File.ReadAllBytes(metafile);
|
||||
manifest = JsonSerializer.Deserialize<PluginManifest>(data, _jsonOptions);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error reading file {Path}.", dir);
|
||||
}
|
||||
catch (JsonException ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error deserializing {Path}.", dir);
|
||||
}
|
||||
_logger.LogError(ex, "Error deserializing {Json}.", Encoding.UTF8.GetString(data!));
|
||||
}
|
||||
|
||||
if (manifest != null)
|
||||
|
@ -537,6 +542,7 @@ namespace Emby.Server.Implementations.Plugins
|
|||
|
||||
return new LocalPlugin(dir, _appVersion >= targetAbi, manifest);
|
||||
}
|
||||
}
|
||||
|
||||
// No metafile, so lets see if the folder is versioned.
|
||||
// TODO: Phase this support out in future versions.
|
||||
|
|
Loading…
Reference in New Issue
Block a user