WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 6 months ago

#52210 new defect (bug)

File URL gets saved even when upload fails

Reported by: kkroeger93 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 5.6
Component: Database Keywords:
Focuses: Cc:

Description

Description
A File URL reference gets saved into the wp_posts table even when upload fails.

I recognized the issue when I uploaded a attachment into my WordPress Site.

Steps I performed:

1. Uploaded a file that was not allowed (e.g a file with .svg ext)
The upload failed because I didn't had the ALLOW_UNFILTERED_UPLOADS Constant set to true.

2. Changed the ALLOW_UNFILTERED_UPLOADS constant to true and re-uplaoded the file.
The file upload worked this time.

3. Tried to open the attachment
I realized that the URL was altert by a filename-1.ext.

Things I checked:

I checked the Changesets and found this Change Log: https://core.trac.wordpress.org/changeset/46822

Conclusion
I assume there is a Bug which saves the upload attempt into regardless if its completed successfully or not.

Change History (1)

#1 @9primus
6 months ago

Hello kkroeger93 ! I can not performed this bug , when I have only 'ALLOW_UNFILTERED_UPLOADS' in wp-config.php , frontend js code stops me to download SVG image , but when I have 'ALLOW_UNFILTERED_UPLOADS' in wp-config and


<?php
add_filter('plupload_default_settings', function ($settings) {
     if (defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS) {
         unset($settings['filters']['mime_types']);
   }

in my functions.php file its work fine

Note: See TracTickets for help on using tickets.