catch http exception and fix possible issues

pull/5217/head
dkanada 4 years ago
parent fb2d178242
commit 9bfe945f6c

@ -384,6 +384,9 @@ namespace Emby.Server.Implementations.Plugins
imagePath = Path.Join(path, url.Segments[^1]); imagePath = Path.Join(path, url.Segments[^1]);
await using var fileStream = File.OpenWrite(imagePath); await using var fileStream = File.OpenWrite(imagePath);
try
{
await using var downloadStream = await HttpClientFactory await using var downloadStream = await HttpClientFactory
.CreateClient(NamedClient.Default) .CreateClient(NamedClient.Default)
.GetStreamAsync(url) .GetStreamAsync(url)
@ -391,6 +394,12 @@ namespace Emby.Server.Implementations.Plugins
await downloadStream.CopyToAsync(fileStream).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 var manifest = new PluginManifest
{ {

Loading…
Cancel
Save