Skip to content

fix(share): read a web link that loadItem returns as Data - #1066

Merged
bmc08gt merged 1 commit into
mainfrom
fix/share-input-tests
Oct 14, 2026
Merged

bmc08gt merged 1 commit into
mainfrom
fix/share-input-tests

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Two ShareInputTests cases fail on main: "A web link prefills the message" and "A link wins over the page title Safari sends beside it". The parser was wrong, not the expectations.

For an NSURL registered as public.url, loadItem(forTypeIdentifier:) with no class to coerce to returns the URL's UTF-8 bytes (NSConcreteData, 25 bytes for https://example.com/a?b=1), not a URL object. loadWebURL matched only URL, NSURL and String, so it returned nil. The prefill then fell back to the page title, or to nil when the link was the only provider.

The fix adds a Data case that reads the bytes with URL(dataRepresentation:relativeTo:), matching how loadText already handles Data. The file-URL check still runs afterwards, so a file shared from Files still isn't treated as message text.

Both tests landed with the parser in #1041 and neither file has changed since. I reproduced the failure with swift test on macOS; none of this repo's GitHub workflows runs the FlipcashCore suite, so I haven't checked how the parser behaves with Safari's own provider on iOS. The new case only adds a shape it accepts, so a provider that hands back a URL takes the same path as before.

Two ShareInputTests cases failed on main: "A web link prefills the
message" and "A link wins over the page title Safari sends beside it".
For an NSURL registered as public.url, loadItem with no class to coerce
to returns the URL's UTF-8 bytes as NSConcreteData, not a URL object.
loadWebURL had no Data case, so it dropped the link and the prefill
fell back to the page title, or to nil.

Read Data with URL(dataRepresentation:relativeTo:), the same way
loadText already reads Data.
@bmc08gt bmc08gt self-assigned this Oct 14, 2026
@bmc08gt
bmc08gt merged commit 0a14986 into main Oct 14, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant