File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 77 */
88
99use Neos \Flow \Annotations as Flow ;
10+ use Neos \Flow \ResourceManagement \Exception as ResourceException ;
1011use Neos \Flow \ResourceManagement \PersistentResource ;
1112use Neos \Flow \ResourceManagement \ResourceManager ;
1213use Neos \SwiftMailer \Message ;
@@ -157,12 +158,13 @@ private function embedPlainResourceCallback(array $matches): string
157158 return $ plain ;
158159 }
159160
160- /**
161- * @param PersistentResource $resource
162- * @return Swift_Attachment
163- */
164- public function createSwiftAttachmentFromPersistentResource (PersistentResource $ resource ): Swift_Attachment
161+ public function createSwiftAttachmentFromPersistentResource (PersistentResource $ resource ): ?Swift_Attachment
165162 {
163+ if (!is_string ($ resource ->getSha1 ())) {
164+ // Throw exception to prevent type error on getCacheEntryIdentifier(): "Return value must be of type string, null returned"
165+ throw new ResourceException ('No sha1 set in persistent resource ' , 1733826832 );
166+ }
167+
166168 // No exception handling here. This provides flexibility to handle it outside or by aspects
167169 $ path = $ resource ->createTemporaryLocalCopy ();
168170 $ attachment = Swift_Attachment::fromPath ($ path , $ resource ->getMediaType ());
You can’t perform that action at this time.
0 commit comments