#38976 closed defect (bug) (wontfix)
REST API: Allow multiple leading slashes at the beginning of the endpoint path
Reported by: | jnylen0 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7 |
Component: | REST API | Keywords: | has-patch close |
Focuses: | Cc: |
Description
Follow-up to #38873. The official API console is currently broken on all of my sites due to a duplicated slash in between the REST prefix and the namespace (wp-json//wp/v2/posts
):
Since this is an easy mistake to make, and it's broken in a released plugin, let's fix it.
Attachments (1)
Change History (8)
#2
@
8 years ago
Under other permalink structures, it looks like this change will still fix things without breaking other things.
Plain permalinks
The console sends /?rest_route=//wp/v2/posts
which fails unless this change is made.
PATHINFO permalinks
Permalink structure: /index.php/%year%/%monthnum%/%day%/%postname%/
The console sends /index.php/wp-json//wp/v2/posts
which works fine either way.
The rest_route
query var is correctly /wp/v2/posts
before this change; I'm not sure if this is because of my server or WP internals.
#3
@
8 years ago
I might be misunderstanding this, is it that we should support //
in URLs, or is it that we should never make URLs with //
in them? If it's the former, I think that's a terrible idea, if it's the latter, I think it's a great idea :D
This ticket was mentioned in Slack in #core-restapi by joehoyle. View the logs.
8 years ago
#5
@
8 years ago
There is at least 1 plugin out in the wild that does this incorrectly... and it's by "WP REST API Team" and we officially promote it.
Presumably the console worked at one point, so whenever it stopped working was a BC break.
Also, if the people most familiar with the API made a mistake here, how can we expect other WP devs not to make the same mistake?
#6
@
8 years ago
- Keywords close added
As noted in the #core-restapi slack channel they console plugin was a 1 week hack project to port over the WordPress.com console for the REST API. The console plugin should be fixed (and will be by @joehoyle).
I do not think we should support //
paths in core and recommend closing this ticket.
https://wordpress.slack.com/archives/core-restapi/p1480462513002736
#7
@
8 years ago
- Milestone 4.7 deleted
- Resolution set to wontfix
- Status changed from new to closed
It looks like this is already fixed in the plugin's repo: https://github.com/WP-API/rest-api-console/commit/cf73d647dbce4d7e6f27a703884136546e6c47ff
@rmccue can you deploy a new version of the console plugin from master
? Edit: done, thanks!
@jnylen0 What is the impact of this change on sites with non-pretty permalinks or index links?