[wp-trac] [WordPress Trac] #19354: wp_allowed_protocols() does not allow data URI scheme

WordPress Trac noreply at wordpress.org
Tue Nov 1 14:31:16 UTC 2016


#19354: wp_allowed_protocols() does not allow data URI scheme
------------------------------------+----------------------
 Reporter:  hardy101                |       Owner:
     Type:  defect (bug)            |      Status:  closed
 Priority:  normal                  |   Milestone:
Component:  General                 |     Version:  3.2.1
 Severity:  normal                  |  Resolution:  wontfix
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+----------------------

Comment (by mrahmadawais):

 Looks like `data` was removed and now if you try and add bas64 image data
 URI `data` with WP REST API it gets ignored.

 I had to add it through the filter.

 {{{#!php
 <?php

 /**
  * Allow data protocol..
  *
  * @since 1.1.0
  */
 if ( ! function_exists( 'aa_allow_data_protocol' ) ) {
         add_filter( 'kses_allowed_protocols' , 'aa_allow_data_protocol' );
         /**
          * aa_allow_data_protocol
          *
          * @param  array $protocols
          * @return array
          * @since  1.1.0
          */
         function aa_allow_data_protocol( $protocols ) {
                 $protocols[] = 'data';
                 return $protocols;
         }
 }

 }}}

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


More information about the wp-trac mailing list