From b209d047fa9949eb7e1c1a503ee10939049d87df Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 14 Sep 2023 17:07:32 -0700 Subject: [PATCH] Fixed: Don't try to create metadata images if source files doesn't exist (cherry picked from commit 9a1022386a031c928fc0495d6ab990ebce605ec1) Closes #2933 --- src/NzbDrone.Core/Extras/Metadata/MetadataService.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs b/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs index 10cbbad95..63aff7d53 100644 --- a/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs +++ b/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs @@ -346,6 +346,7 @@ namespace NzbDrone.Core.Extras.Metadata private void DownloadImage(Author author, ImageFileResult image) { var fullPath = Path.Combine(author.Path, image.RelativePath); + var downloaded = true; try { @@ -353,12 +354,19 @@ namespace NzbDrone.Core.Extras.Metadata { _httpClient.DownloadFile(image.Url, fullPath); } - else + else if (_diskProvider.FileExists(image.Url)) { _diskProvider.CopyFile(image.Url, fullPath); } + else + { + downloaded = false; + } - _mediaFileAttributeService.SetFilePermissions(fullPath); + if (downloaded) + { + _mediaFileAttributeService.SetFilePermissions(fullPath); + } } catch (WebException ex) {