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

WordPress Trac noreply at wordpress.org
Wed Mar 9 07:34:59 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):

 With the knowledge of what @dd32 just mentioned, it seems the viable
 solution outside of moving strip_fragment_from_url out of canonical (which
 is excessive) is to strip the fragment and beyond with strpos, etc. as the
 query string was.

 {{{#!php
 <?php
 $frag_pos = strpos( $filename, '#' );

 if ( false !== $frag_pos) {
   $filename = substr($filename,0, $frag_pos-1)
 }
 ?>
 }}}

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


More information about the wp-trac mailing list