diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2021-02-24 00:03:26 +0900 |
|---|---|---|
| committer | dkanada <dkanada@users.noreply.github.com> | 2021-02-24 00:03:26 +0900 |
| commit | 9bfe945f6c1f41ea3456ae27b1ad31a04f3cea3f (patch) | |
| tree | 05f44068816c56f8c910a4435ae9434583216490 /Emby.Server.Implementations/Plugins/PluginManager.cs | |
| parent | fb2d17824225e9849a45bc146fa6e09f3c71b1fb (diff) | |
catch http exception and fix possible issues
Diffstat (limited to 'Emby.Server.Implementations/Plugins/PluginManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Plugins/PluginManager.cs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.cs index d8dac6599..7bc9f0a7e 100644 --- a/Emby.Server.Implementations/Plugins/PluginManager.cs +++ b/Emby.Server.Implementations/Plugins/PluginManager.cs @@ -384,12 +384,21 @@ namespace Emby.Server.Implementations.Plugins imagePath = Path.Join(path, url.Segments[^1]); await using var fileStream = File.OpenWrite(imagePath); - await using var downloadStream = await HttpClientFactory - .CreateClient(NamedClient.Default) - .GetStreamAsync(url) - .ConfigureAwait(false); - await downloadStream.CopyToAsync(fileStream).ConfigureAwait(false); + try + { + await using var downloadStream = await HttpClientFactory + .CreateClient(NamedClient.Default) + .GetStreamAsync(url) + .ConfigureAwait(false); + + await downloadStream.CopyToAsync(fileStream).ConfigureAwait(false); + } + catch (HttpRequestException ex) + { + _logger.LogError(ex, "Failed to download image to path {Path} on disk.", imagePath); + imagePath = string.Empty; + } } var manifest = new PluginManifest |
