Skip to content

Commit

Permalink
Use addQueryArgs() to build the oEmbed proxy URL (#2097)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlh01 authored and notnownikki committed Jul 31, 2017
1 parent 581b585 commit e514290
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion blocks/library/embed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { includes } from 'lodash';
import { __, sprintf } from 'i18n';
import { Component } from 'element';
import { Button, Placeholder, Spinner, SandBox } from 'components';
import { addQueryArgs } from 'editor/utils/url';

/**
* Internal dependencies
Expand Down Expand Up @@ -84,7 +85,10 @@ function getEmbedBlockSettings( { title, icon, category = 'embed' } ) {
event.preventDefault();
}
const { url } = this.props.attributes;
const apiURL = wpApiSettings.root + 'oembed/1.0/proxy?url=' + encodeURIComponent( url ) + '&_wpnonce=' + wpApiSettings.nonce;
const apiURL = addQueryArgs( wpApiSettings.root + 'oembed/1.0/proxy', {
url: url,
_wpnonce: wpApiSettings.nonce,
} );

this.setState( { error: false, fetching: true } );
window.fetch( apiURL, {
Expand Down

0 comments on commit e514290

Please sign in to comment.