From f6c038da0c19de439598d2f62218ead17ba46e09 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 20 Feb 2017 06:34:17 +0000 Subject: [PATCH] REST API: JavaScript client should use `_.extend` when merging objects. Correct an issue during the client's dynamic route discovery in `wp.api.utils.decorateFromRoute` where `_.union` potentially failed if used on objects. Props ketuchetan, adamsilverstein. Merges [40040] to the 4.7 branch. Fixes #39341. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40084 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/wp-api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/wp-api.js b/src/wp-includes/js/wp-api.js index ccda6a0e8b..da16e3c491 100644 --- a/src/wp-includes/js/wp-api.js +++ b/src/wp-includes/js/wp-api.js @@ -185,7 +185,7 @@ } else { // We already have args, merge these new args in. - modelInstance.prototype.args = _.union( routeEndpoint.args, modelInstance.prototype.defaults ); + modelInstance.prototype.args = _.extend( modelInstance.prototype.args, routeEndpoint.args ); } } } else { @@ -202,7 +202,7 @@ } else { // We already have options, merge these new args in. - modelInstance.prototype.options = _.union( routeEndpoint.args, modelInstance.prototype.options ); + modelInstance.prototype.options = _.extend( modelInstance.prototype.options, routeEndpoint.args ); } }