[wp-trac] [WordPress Trac] #44745: REST API: incorrect slashes in url if parent empty
WordPress Trac
noreply at wordpress.org
Sat Oct 24 18:13:40 UTC 2020
#44745: REST API: incorrect slashes in url if parent empty
--------------------------+------------------------------
Reporter: nicomollet | Owner: adamsilverstein
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.9.8
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript
--------------------------+------------------------------
Changes (by adamsilverstein):
* owner: (none) => adamsilverstein
* status: new => assigned
Comment:
> @adamsilverstein Do you have the bandwidth to take a look at this?
Sure, I can try.
@nicomollet Thank you for reporting this issue. Your code change makes
sense if `this.parent` can be empty during collection route construction,
which apparently it can!
I have a follow up question:
> The parent is sometimes empty, leading to two consecutive slashes.
Do you have a code sample for the endpoint (or steps to reproduce this)? I
do see where we use a similar (hard to read) trinary above
[https://github.com/WordPress/wordpress-
develop/blob/8e3636b0d62146164708e69ee36917db6b4639be/src/js/_enqueues/wp/api.js#L1312
when using `this.parent` in the model route construction].Just curious how
to recreate with a collection.
Have you tested the fix above you proposed and verified it works as
expected for your endpoints?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44745#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list