File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -195,9 +195,9 @@ private function extractHeadersAndBody()
195195 $ this ->rawBodyLines = \array_slice ($ lines , $ i );
196196 break ;
197197 }
198-
199- // start of new header
198+ // check is line starting With printable character
200199 if (\preg_match ('/^[A-Za-z]/ ' , $ line )) {
200+ // start of new header
201201 \preg_match ('/([^:]+): ?(.*)$/ ' , $ line , $ matches );
202202 $ newHeader = \strtolower ($ matches [1 ]);
203203 $ value = $ matches [2 ];
@@ -240,6 +240,19 @@ public function addMimeType($mime_types = '')
240240 return $ this ;
241241 }
242242
243+ /**
244+ * Add additional disallowed mime types to the list.
245+ *
246+ * @param string
247+ */
248+ public function removeMimeType ($ mime_types = '' )
249+ {
250+ if (\strpos ($ mime_types , '/ ' ) !== false )
251+ \array_push ($ this ->disallowedMimeTypes , $ mime_types );
252+
253+ return $ this ;
254+ }
255+
243256 /**
244257 * @return string - UTF8 encoded
245258 *
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ public function testPlainBody()
8383
8484 $ file = __DIR__ . '/emails/m0002 ' ;
8585 $ email = new MailParser (\file_get_contents ($ file ));
86+ $ email ->removeMimeType ('audio/caf ' );
8687 $ expect = '
8788Hello,
8889
You can’t perform that action at this time.
0 commit comments