[wp-trac] [WordPress Trac] #30377: wp_check_filetype is broken when checking urls with parameters

WordPress Trac noreply at wordpress.org
Wed Mar 9 08:21:42 UTC 2022

#30377: wp_check_filetype is broken when checking urls with parameters
 Reporter:  supercleanse                         |       Owner:  audrasjb
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.0
Component:  Media                                |     Version:  4.0
 Severity:  normal                               |  Resolution:
 Keywords:  has-unit-tests needs-dev-note        |     Focuses:
  needs-patch                                    |

Comment (by Ruxton):

 All very fair, someone actually wrote a patch with what you want and you
 responded to it at the time, then it somehow just drifted away from that.

 If patch 3 is the solution you want, should we refresh that and include
 the tests from John's patch? Would that get us to a better place?

 I'm just trying to get this across the line. It's old, annoying and a
 resolution is needed.

 Replying to [comment:63 dd32]:
 > Pulling out two comments from above:
 >  - [comment:19 Comment by me]: I'd personally prefer to add an explicit
 `wp_check_url_filetype()` function instead, one which extracts the actual
 filename from the URL and passes it along to `wp_check_filetype()` (if
 appropriate, or duplicates parts of it)
 >  - [comment:27 Comment by Helen]: Changing to enhancement, as
 `wp_check_filetype()` was never meant for URLs and the solution in this
 case is to introduce something else that does work for URLs.
 > Even if the existing function is being passed URLs, it's not
 intentionally supposed to be used for URLs, and performing processing like
 this is doomed for failure.

Ticket URL: <https://core.trac.wordpress.org/ticket/30377#comment:64>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list