[wp-trac] [WordPress Trac] #50695: Make media_sideload_image extension list filterable

WordPress Trac noreply at wordpress.org
Sun Oct 18 20:10:04 UTC 2020


#50695: Make media_sideload_image extension list filterable
---------------------------------------------+---------------------
 Reporter:  paulschreiber                    |       Owner:  (none)
     Type:  enhancement                      |      Status:  new
 Priority:  normal                           |   Milestone:  5.6
Component:  Media                            |     Version:
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch needs-dev-note commit  |     Focuses:
---------------------------------------------+---------------------
Changes (by johnbillion):

 * keywords:  has-patch needs-dev-note needs-unit-tests => has-patch needs-
     dev-note commit


Comment:

 I've been trying to restructure this code so it's nicely testable, but
 there is so much code that's tightly coupled to actually downloading the
 file that it's turning into a rabbit hole.

 I don't think there's a need to verify that the extension list is valid,
 this is not something that core typically does with other filters and if
 an invalid value is returned then it'll trigger a PHP warning, which is an
 appropriate means of showing an error for incorrect code.

 I've just pushed a tweak to Paul's PR to improve the filter name, docs,
 and add the `$file` parameter for extra context, as well as
 `preg_quote`-ing the list.

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


More information about the wp-trac mailing list