GBK Plain Permalink Support
维护者通常 1 天内回复
@dcalhoun 已经在做这个了。
开始于 2026年7月31日。
评估
这个 Issue 还没有评估数据。
描述
GutenbergKit's native REST URL builder assumes a path-based site API root, so it can't address a self-hosted WordPress site that uses plain permalinks — where the only REST root is the query form https://site/?rest_route=/.
Summary
WordPressRESTURL.namespaced(iOS) andRestUrlBuilder.namespaced(Android) build every native REST URL by appending the endpoint to the path (apiRoot.appending(path:)/ string concat).- A plain-permalink site has no path-based REST root:
/wp-json/depends on the rewrite rules that plain permalinks disable, so WordPress advertises?rest_route=/as the site's REST root. - Result: for such a site, every native REST URL is malformed — not just media uploads.
- WP.com sites are unaffected — they're reached through the path-based
public-api.wordpress.com/proxy (SitePreparationView.swift/SitePreparationViewModel.ktsetsiteApiRoot = https://public-api.wordpress.com/), which abstracts the underlying site's permalinks away.
Root cause
namespaced does apiRoot.appending(path:). Given siteApiRoot = https://site/?rest_route=/:
namespaced(root, "/wp-block-editor/v1/settings") → https://site/wp-block-editor/v1/settings?rest_route=/ → 404
namespaced(root, "/wp/v2/media") → https://site/wp/v2/media?rest_route=/ → 404
The /wp/v2/… lands on the URL path (which doesn't route on a plain-permalink site) with a stray rest_route=/ query, instead of https://site/?rest_route=/wp/v2/media.
Impact
Every endpoint routed through namespaced — in RESTAPIRepository alone: editor settings, active theme, site settings, post types — plus the native media-upload endpoint. namespaced has no rest_route handling and its unit tests (both platforms) cover only path-based roots.
This is pre-existing — the logic was extracted from the prior buildNamespacedURL and carried the assumption forward. It surfaced while reviewing the native media-upload work (#561), whose mediaEndpointURL relies on namespaced.
Proposed fix
Teach namespaced (both platforms) to detect a rest_route query on the root and append the endpoint — and the site namespace — to the rest_route value rather than the URL path:
root = https://site/?rest_route=/
build /wp/v2/media → https://site/?rest_route=/wp/v2/media ✓
Path-based roots keep today's behavior. Add the query-based-root tests the builders never had. This fixes all native endpoints at once, and the media upload's ?_embed=wp:featuredmedia query then merges correctly for free (there's a latent iOS/Android divergence in mediaEndpointURL's query append — percentEncodedQuery overwrite vs + concat — that's moot until the base is correct).
Open question
Reachability depends on whether the host apps (WordPress-iOS / Jetpack) actually connect to self-hosted plain-permalink sites and hand GutenbergKit a ?rest_route= root. Worth confirming before prioritizing — though a plain-permalink site has nothing else it could hand over.
- 主要语言
- JavaScript
- 星标
- 29
- 派生
- 7
- 平均合并
- 2 天 11 小时
- 30 天内合并 PR
- 75
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wordpress-mobile/GutenbergKit 的其他 Issue
-
[Type] Bug Android
难度 2/5 1-3 小时 新手友好度 79/100
wordpress-mobile/GutenbergKit#847 ·
维护者通常 1 天内回复
-
[Type] Bug iOS
难度 2/5 1-3 小时 新手友好度 77/100
wordpress-mobile/GutenbergKit#846 ·
维护者通常 1 天内回复
-
[Type] Bug [Type] Code Quality iOS
难度 2/5 1-3 小时 新手友好度 88/100
wordpress-mobile/GutenbergKit#668 ·
维护者通常 1 天内回复
-
[Type] Bug [Type] Performance iOS
难度 2/5 1-3 小时 新手友好度 88/100
wordpress-mobile/GutenbergKit#666 ·
维护者通常 1 天内回复
-
[Type] Bug iOS
难度 2/5 1-3 小时 新手友好度 78/100
wordpress-mobile/GutenbergKit#664 ·
维护者通常 1 天内回复
查看 wordpress-mobile/GutenbergKit 的全部 Issue
相似的 Issue
-
area: core complexity: easy impact: medium
难度 2/5 1-3 小时 新手友好度 86/100
ueberdosis/tiptap#8668 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
follow-redirects - CVE-2026-116689可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1 小时以内 新手友好度 70/100
axios/axios#11409 · 1 个 reaction ·
维护者通常 1 天内回复
-
channels:add check:passed
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 4 天内回复
-
upstream-dfinity-icp-cli-recipes-static-site upstream-sync
难度 2/5 1-3 小时 新手友好度 78/100
dfinity/developer-docs#442 ·
维护者通常 2 天内回复