Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#35629 closed defect (bug) (fixed)

Fix link handling in WP_REST_Server->embed_links()

Reported by: danielbachhuber's profile danielbachhuber Owned by:
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.4
Component: REST API Keywords:
Focuses: Cc:

Description (last modified by danielbachhuber)

While fixing one bug, I ran into another.

  1. Convert WP_Error to WP_REST_Response in WP_REST_Server->embed_links(). Later on WP_REST_Server->response_to_data() expects to always receive WP_REST_Response. With the current code, a WP_Error object returned from dispatch() inside of embed_links() would fatal, because WP_Error doesn't implement the same methods as WP_REST_Response
  2. Properly support non-pretty permalink REST routes. won't be embedded because it doesn't match


Attachments (1)

35629.1.diff (4.1 KB) - added by danielbachhuber 8 years ago.

Download all attachments as: .zip

Change History (6)

#1 @danielbachhuber
8 years ago

  • Description modified (diff)

#2 @danielbachhuber
8 years ago

Actually, the first item is a non-issue because dispatch() always returns WP_REST_Response.

Attached is a patch to fix the second issue.

#3 @danielbachhuber
8 years ago

#35803 is a better abstraction which will fix this issue too

This ticket was mentioned in Slack in #core-restapi by danielbachhuber. View the logs.

8 years ago

#5 @danielbachhuber
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed
  • Version set to 4.4

Fixed in r36674

Note: See TracTickets for help on using tickets.