WordPress.org

Making WordPress.org

Changeset 7548


Ignore:
Timestamp:
07/31/2018 02:29:30 AM (3 years ago)
Author:
obenland
Message:

Gutenberg: Bulletproofing endpoint checks.

Props noisysocks.
See #3703.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/functions.php

    r7547 r7548  
    3535            sprintf(
    3636                'wp.apiFetch.use( function( options, next ) {
    37                     var is_whitelisted_endpoint = options.path.startsWith( "/oembed/1.0/proxy" ) || options.path.startsWith( "/gutenberg/v1/block-renderer" );
    38 
    39                     if ( options.method !== "GET" && ! is_whitelisted_endpoint ) {
     37                    var isWhitelistedEndpoint = (
     38                        lodash.startsWith( options.path, "/oembed/1.0/proxy" ) ||
     39                        lodash.startsWith( options.path, "/gutenberg/v1/block-renderer" )
     40                    );
     41
     42                    if ( options.method !== "GET" && ! isWhitelistedEndpoint ) {
    4043                        return Promise.resolve( options.data ); //not sure what this actually should be, etc.
    4144                    }
Note: See TracChangeset for help on using the changeset viewer.