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,8 +1412,11 @@
|
||||
// Function that returns a constructed url passed on the parent.
|
||||
url: function() {
|
||||
return routeModel.get( 'apiRoot' ) + routeModel.get( 'versionString' ) +
|
||||
parentName + '/' + this.parent + '/' +
|
||||
routeName;
|
||||
parentName + '/' +
|
||||
( ( _.isUndefined( this.parent ) || '' === this.parent ) ?
|
||||
( _.isUndefined( this.get( 'parent_post' ) ) ? '' : this.get( 'parent_post' ) + '/' ) :
|
||||
this.parent + '/' ) +
|
||||
routeName;
|
||||
},
|
||||
|
||||
// Specify the model that this collection contains.
|
||||
|
Loading…
Reference in New Issue
Block a user