fix(ios): gate the media upload server on the site root too - #624
Draft
jkmassel wants to merge 1 commit into
Draft
fix(ios): gate the media upload server on the site root too#624jkmassel wants to merge 1 commit into
jkmassel wants to merge 1 commit into
Conversation
`startUploadServer` checked only `authHeader.isEmpty`, though the comment directly above it said the uploader "needs a site root and an auth header". Android has checked both since it landed. An iOS host that configured an auth header but no `siteApiRoot` therefore started a server whose every request failed at the URLSession layer, instead of falling back to the WebView upload path the way Android does. `siteApiRoot` is a `URL` here where Android types it as a `String`, so `isEmpty()` has no direct equivalent — "addressable" is spelled as scheme and host both being present. Put the check in `MediaServerCredentials` rather than inline. `EditorViewController` is `#if canImport(UIKit)`, so it does not exist on the macOS host and nothing in it is reachable from the test suite — which is how the two platforms diverged here unnoticed. Outside the gate, the predicate gets five tests, including both arms of the site-root check.
This was referenced Sep 5, 2026
XCFramework BuildThis PR's XCFramework is available for testing. Add the following to your .package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/624")Built from 72b6329 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #594. First of ten PRs splitting #621; each is a single commit on the one before.
What?
iOS starts the native media upload server without checking that
siteApiRootis usable. Android has checked it since it landed.Why?
startUploadServerguards onauthHeader.isEmptyalone, though the comment directly above it says the uploader "needs a site root and an auth header". An iOS host that configured an auth header but nositeApiRootstarted a server whose every request failed at the URLSession layer, instead of falling back to the WebView upload path the way Android does.The two platforms diverged here unnoticed because the check lives in
EditorViewController, which is#if canImport(UIKit)— it does not exist on the macOS host, so nothing in it is reachable from the test suite.How?
areUsable(siteApiRoot:authHeader:)owns the check, outside the UIKit gate so it is testable.startUploadServercalls it.siteApiRootis aURLhere where Android types it as aString, soisEmpty()has no direct equivalent — "addressable" is spelled as scheme and host both being present.Testing Instructions
Five tests pin the predicate, including both arms of the site-root check.
swift test— host suite greenxcodebuild(the host build compilesEditorViewControlleras empty, so the gated change needs a simulator build)