Open
Description
Steps:
- add some allowed file type but define it with comma separated mime types when the first one is for sure not correct (for example for XML file add
foo/bar,text/xml
mime types - try to upload this file
It will be not uploaded because in the FileUploadTypes\Plugin::allowed_types
we are removing other mime types and are using only the first one.
This should be rewritten to something like:
public function allowed_types( $mime_types ): array {
$mime_types = (array) $mime_types;
$enabled_types = $this->enabled_types();
foreach( $enabled_types as $ext => $mime ) {
if ( is_array( $mime ) ) {
$i = 1;
foreach ($mime as $m) {
if ( $i === 1 ) {
$enabled_types[$ext] = $m;
continue;
}
$enabled_types[$ext . '_' . $i] = $m;
$i++;
}
}
}
return array_replace( $mime_types, $enabled_types );
}
The risk of this change is high, so it can not be added without caution
Metadata
Metadata
Assignees
Labels
No labels