Opened 6 years ago
Closed 6 years ago
#44750 closed defect (bug) (fixed)
Attributes unexpectedly lost in attachment links
Reported by: | TimothyBlynJacobs | Owned by: | danielbachhuber |
---|---|---|---|
Milestone: | 5.0 | Priority: | normal |
Severity: | major | Version: | 4.9.8 |
Component: | REST API | Keywords: | has-patch has-unit-tests fixed-5.0 |
Focuses: | rest-api | Cc: |
Description
#44287 changed the attachments controller to use the links generated from the original response by the posts controller. However, the add_links()
method used has a different format than get_links()
returned causing the original attributes to be nested under an “attributes” key instead of being inline with the href
attribute.
I’ve attached a patch to fix this that adds tests to check the attributes for the links as well, not just that the relations exist.
Reported by @soean in Slack, https://wordpress.slack.com/archives/C02RQC26G/p1533552138000130.
Attachments (2)
Change History (12)
This ticket was mentioned in Slack in #core by pbiron. View the logs.
6 years ago
#4
@
6 years ago
- Summary changed from #44287 caused attachment link attributes to be lost to Attributes unexpectedly lost in attachment links
#6
follow-up:
↓ 7
@
6 years ago
I think that might be the byproduct of the fix. When I used get_links()
it had the attributes nested in that format, but fixing it to do it iteratively means we don't have the attributes
listed for links with no extra attributes. Looking at other mocked API responses in that file, it looks to be the intended format.
#7
in reply to:
↑ 6
@
6 years ago
Replying to TimothyBlynJacobs:
Looking at other mocked API responses in that file, it looks to be the intended format.
Ah, I should've done this :) You're a smarter person than I.
#8
@
6 years ago
- Owner set to danielbachhuber
- Resolution set to fixed
- Status changed from new to closed
In 43681:
@TimothyBlynJacobs When I ran
phpunit --group restapi
locally, I ended up with this unintended side-effect:Do you know what the cause might be?