Created
January 11, 2024 07:58
-
-
Save michaellopez/96c433746f63bda45415de2872b27b03 to your computer and use it in GitHub Desktop.
swiftmailer bad/missing attachment fix patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Plugin/Mail/SwiftMailer.php b/src/Plugin/Mail/SwiftMailer.php | |
index e9830ac..4e0bcb9 100644 | |
--- a/src/Plugin/Mail/SwiftMailer.php | |
+++ b/src/Plugin/Mail/SwiftMailer.php | |
@@ -479,7 +479,15 @@ class SwiftMailer implements MailInterface, ContainerFactoryPluginInterface { | |
$content = file_get_contents($image->uri); | |
} | |
else { | |
- $content = file_get_contents(\Drupal::service('file_system')->realpath($image->uri)); | |
+ $image_path = \Drupal::service('file_system')->realpath($image->uri); | |
+ if (empty($image_path)) { | |
+ continue; | |
+ } | |
+ $content = file_get_contents($image_path); | |
+ } | |
+ | |
+ if (empty($content)) { | |
+ continue; | |
} | |
$filename = $image->filename; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Against 8.x-2.x (1ad24cdf841fe309f689fd3c8cdce1014114c27b)