REST API: JS Client - improve collection route construction for empty parents.
Fix an issue where the constructed path for hierarchical collections could contain a double slash ("//") when items contained empty parents, causing an error. Props nicomollet. Fixes #44745. git-svn-id: https://develop.svn.wordpress.org/trunk@49390 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cbcc595974
commit
ae33c9414c
@ -1412,7 +1412,10 @@
|
|||||||
// Function that returns a constructed url passed on the parent.
|
// Function that returns a constructed url passed on the parent.
|
||||||
url: function() {
|
url: function() {
|
||||||
return routeModel.get( 'apiRoot' ) + routeModel.get( 'versionString' ) +
|
return routeModel.get( 'apiRoot' ) + routeModel.get( 'versionString' ) +
|
||||||
parentName + '/' + this.parent + '/' +
|
parentName + '/' +
|
||||||
|
( ( _.isUndefined( this.parent ) || '' === this.parent ) ?
|
||||||
|
( _.isUndefined( this.get( 'parent_post' ) ) ? '' : this.get( 'parent_post' ) + '/' ) :
|
||||||
|
this.parent + '/' ) +
|
||||||
routeName;
|
routeName;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user