[wp-trac] [WordPress Trac] #47448: CSV import MIME type fails with HTML content

WordPress Trac noreply at wordpress.org
Fri May 31 15:54:01 UTC 2019


#47448: CSV import MIME type fails with HTML content
--------------------------+-----------------------------
 Reporter:  netweblogic   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Related to #45615 which is not fully resolved.

 I've noticed that with CSV uploads, if a CSV contains HTML (which is valid
 content for a CSV file), the MIME type in the following function gets
 returned as 'text/html':

 https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/functions.php#L2567

 {{{#!php
 $real_mime = finfo_file( $finfo, $file );
 }}}

 Here's a simple CSV file sample that demonstrates the problem. Try
 uploading that to media and you get

 > Sorry, this file type is not permitted for security reasons.

 {{{
 "Name","Surname","DOB","Text"
 "John","Smith","1980-01-01","<a
 href=""http://wordpress.org/"">WordPress</a>"
 }}}

 Remove the HTML in there, and it uploads without issue. I think CSV should
 permit text/html as well as a valid mime type.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47448>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list