5 | | I would suggest that even if core is not going to be modified to make this function properly handle SVGs, it should at least be modified to not run the function if the MIME type is image/svg+xml. What it's returning "gets the job done" in terms of blocking SVG uploads, but it's not technically correct. Since wp_get_image_mime() relies on PHP functions that don't know how to handle SVGs, it shouldn't even run on SVG files. |
| 5 | I would suggest that even if core is not going to be modified to make this function properly handle SVGs, it should at least be modified to not run the function if the MIME type is image/svg+xml. What it's returning "gets the job done" in terms of blocking SVG uploads, but it's not technically correct. Since '''wp_get_image_mime()''' relies on PHP functions that don't know how to handle SVGs, it shouldn't even run on SVG files. |
| 6 | |
| 7 | Specifically, I would recommend that '''wp_check_filetype_and_ext()''' be modified (line 2282 in wp-includes/functions.php) from: |
| 8 | |
| 9 | {{{ |
| 10 | if ( $type && 0 === strpos( $type, 'image/' ) ) { |
| 11 | }}} |
| 12 | |
| 13 | to: |
| 14 | |
| 15 | {{{ |
| 16 | if ( $type && 0 === strpos( $type, 'image/' ) && $type != 'image/svg+xml' ) { |
| 17 | }}} |