File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ protected function parse(){
166
166
$ body = $ this ->raw ;
167
167
}
168
168
169
- $ this ->parseSubtype ();
169
+ $ this ->subtype = $ this -> parseSubtype ($ this -> header -> get ( " content-type " ) );
170
170
$ this ->parseDisposition ();
171
171
$ this ->parseDescription ();
172
172
$ this ->parseEncoding ();
@@ -218,12 +218,23 @@ private function findHeaders(){
218
218
219
219
/**
220
220
* Try to parse the subtype if any is present
221
+ * @param $content_type
222
+ *
223
+ * @return string
221
224
*/
222
- private function parseSubtype (){
223
- $ content_type = $ this ->header ->get ("content-type " );
225
+ private function parseSubtype ($ content_type ){
226
+ if (is_array ($ content_type )) {
227
+ foreach ($ content_type as $ part ){
228
+ if ((strpos ($ part , "/ " )) !== false ){
229
+ return $ this ->parseSubtype ($ part );
230
+ }
231
+ }
232
+ return null ;
233
+ }
224
234
if (($ pos = strpos ($ content_type , "/ " )) !== false ){
225
- $ this -> subtype = substr ($ content_type , $ pos + 1 );
235
+ return substr ($ content_type , $ pos + 1 );
226
236
}
237
+ return null ;
227
238
}
228
239
229
240
/**
You can’t perform that action at this time.
0 commit comments