From e8ddaf6ccf4d31cc5454c365ba96da93d4c884f4 Mon Sep 17 00:00:00 2001 From: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com> Date: Thu, 4 Nov 2021 00:17:43 +0000 Subject: [PATCH] Fixed: Audiobooks will not be attached to email notifications --- src/NzbDrone.Core/Notifications/Email/Email.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Notifications/Email/Email.cs b/src/NzbDrone.Core/Notifications/Email/Email.cs index 40ef6f7d8..666bd05de 100644 --- a/src/NzbDrone.Core/Notifications/Email/Email.cs +++ b/src/NzbDrone.Core/Notifications/Email/Email.cs @@ -7,6 +7,7 @@ using MailKit.Security; using MimeKit; using NLog; using NzbDrone.Common.Extensions; +using NzbDrone.Core.MediaFiles; namespace NzbDrone.Core.Notifications.Email { @@ -101,9 +102,16 @@ namespace NzbDrone.Core.Notifications.Email builder.HtmlBody = body; foreach (var url in attachmentUrls) { - byte[] bytes = System.IO.File.ReadAllBytes(url); - builder.Attachments.Add(url, bytes); - _logger.Trace("Attaching: {0}", url); + if (MediaFileExtensions.AudioExtensions.Contains(System.IO.Path.GetExtension(url))) + { + byte[] bytes = System.IO.File.ReadAllBytes(url); + builder.Attachments.Add(url, bytes); + _logger.Trace("Attaching ebook file: {0}", url); + } + else + { + _logger.Trace("Skipping audiobook file: {0}", url); + } } email.Body = builder.ToMessageBody();