[wp-trac] [WordPress Trac] #39625: Give an error message when a non-image is uploaded for featured image

WordPress Trac noreply at wordpress.org
Tue Jul 2 15:10:25 UTC 2019


#39625: Give an error message when a non-image is uploaded for featured image
--------------------------+---------------------
 Reporter:  karmatosed    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.3
Component:  Media         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  ux-feedback   |     Focuses:
--------------------------+---------------------
Changes (by westonruter):

 * milestone:  Awaiting Review => 5.3


Comment:

 This issue is not fixed, no.

 Steps to reproduce:

 1. Create a text file on your computer.
 2. In block editor, on Document panel, click Set Featured Image.
 3. Switch to Upload Files tab.
 4. Select the Text file and upload.
 5. 🚫 Fail: The **Select** button is not disabled, allowing the Text file
 to be selected as the Featured Image.
 6. 🚫 Fail: The Text file is being used as the `src` for the featured
 image in the block editor panel:

 {{{
 <div class="editor-post-featured-image">
         <button type="button" class="components-button editor-post-
 featured-image__preview" aria-label="Edit or update the image">
                 <div class="components-responsive-wrapper">
                         <div></div>
                         <img src="http://example.com/wp-
 content/uploads/2013/10/test.txt" alt="" class="components-responsive-
 wrapper__content">
                 </div>
         </button>
         <button type="button" class="components-button is-button is-
 default is-large">Replace image</button>
         <button type="button" class="components-button is-link is-
 destructive">Remove featured image</button>
 </div>
 }}}

 The uploader needs to respect the file type constraint provided for the
 media library. For instance, the `MediaUpload` component needs to use the
 `allowedTypes` to constrain the selected uploaded files, for example:
 https://github.com/WordPress/gutenberg/blob/6d3312a/packages/editor/src/components
 /post-featured-image/index.js#L53

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/39625#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list