Fix connector approval dismiss for keys containing slashes#615
Conversation
The Dismiss button on the Connector Approvals page failed with "Failed to dismiss request." for any pending entry whose key contains a slash (e.g. `plugin/plugin.php::connector`). The composite key was sent as a URL path segment. WordPress decodes the encoded slash (%2F) back to `/` before REST route matching, so the `(?P<key>[^/]+)` pattern stopped matching and the request 404'd (Apache also rejects %2F-containing paths by default). Pass the key as a query argument instead: it is decoded as a plain value and never participates in path-based route matching, so it works regardless of web server config. Drop the now-redundant rawurldecode() because query args arrive already decoded. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The dismiss route changed from a path parameter (`/connector-approvals/pending/(?P<key>[^/]+)`) to a static path (`/connector-approvals/pending`) with the key sent as a query argument, so the route-registration assertions must expect the new path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #615 +/- ##
==========================================
Coverage 73.18% 73.18%
Complexity 1731 1731
==========================================
Files 85 85
Lines 7473 7473
==========================================
Hits 5469 5469
Misses 2004 2004
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

What?
Fix the Dismiss button on the Connector Approvals settings page, which failed with
Failed to dismiss request.Recording.2026-05-23.160520.mp4
Why?
The dismiss key is a composite of the caller basename and connector ID (example:
wp-json/ai/v1/connector-approvals/pending/ai%2Fai.php%3A%3Agoogle), so it contains a slash. The frontend sent it as a URL path segment. WordPress decodes the encoded slash (%2F) back to/before REST route matching, so the route pattern(?P<key>[^/]+)no longer matched and the request returnedrest_no_route(404).The Approve action was unaffected because it already sends its identifier in the request body, not in the path.
How?
Send the key as a query argument instead of a path segment. Query arguments are decoded as plain values and never take part in path-based route matching, so dismiss works regardless of web server configuration.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.7
Used for: Diagnosing the encoded-slash route-matching failure and implementing the fix. Reviewed and verified by me (
tsc, ESLint, and PHPUnit all pass).Testing Instructions
Failed to dismiss request.Changelog Entry