Skip to content

[agent-cli] navigate percent-encodes the route it opens (llp/0005 §navigate) - #198

Merged
vonovak merged 2 commits into
mainfrom
vonovak/fix-navigate-encode-route
Oct 26, 2026
Merged

vonovak merged 2 commits into
mainfrom
vonovak/fix-navigate-encode-route

Conversation

@vonovak

@vonovak vonovak commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

navigate "/street/U Zeleného stromu" --eas failed with APP_NOT_INSTALLED (dogfood N2-12, N3-36). Routes and full URLs with a space or a non-ASCII character went into the deep link unencoded.

Fix

navigate percent-encodes the route, and the authority and path of a full URL. It keeps URL delimiters, escapes the caller already wrote, and [ ], so an IPv6 host stays a host.

🤖 Generated with Claude Code

@vonovak
vonovak force-pushed the vonovak/fix-navigate-encode-route branch from 606def1 to 613e1fa Compare October 23, 2026 22:22
@vonovak
vonovak marked this pull request as ready for review October 24, 2026 03:41
@vonovak
vonovak requested a review from Kudo October 24, 2026 03:41
@vonovak
vonovak marked this pull request as draft October 24, 2026 05:08
@vonovak
vonovak marked this pull request as ready for review October 24, 2026 07:22
@vonovak
vonovak marked this pull request as draft October 24, 2026 20:33
@vonovak
vonovak force-pushed the vonovak/fix-navigate-encode-route branch from 613e1fa to c33c4a1 Compare October 24, 2026 20:50
@vonovak
vonovak marked this pull request as ready for review October 26, 2026 07:41
(_match, scheme: string, authority: string | undefined, rest: string) =>
scheme +
encodeUrlPart(authority ?? '')
.replace(/%5B/g, '[')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bug] encodeFullUrl runs .replace(/%5B/g, '[').replace(/%5D/g, ']') on the whole authority after encodeUrlPart has folded existing escapes back. That decodes brackets the caller already wrote. myapp://foo%5Bbar%5D/baz used to pass through unchanged and new URL accepts it. It is now myapp://foo[bar]/baz, which throws Invalid URL, so schemeOf skips iOS scheme approval and NSURL URLWithString: returns nil. The same replace rewrites exp://[::1%5D:8081/a into exp://[::1]:8081/a. Lowercase %5b is left alone, so only the usual uppercase form breaks.

Suggestion: Keep raw [ ] only when they wrap an IPv6 host, and protect those characters before encodeUrlPart instead of unescaping every %5B and %5D afterward. An authority that already contains %5B or %5D should stay as written.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 21cd022.

vonovak added a commit that referenced this pull request Oct 26, 2026
Only an IPv6 host gets its `[` `]` back after encodeURI. Escapes the
caller wrote, %5B and %5D included, stay as written. Addresses Kudo's
review on #198.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vonovak and others added 2 commits October 26, 2026 14:07
…vigate)

Problem (N2-12): `navigate "/street/U Zeleného stromu" --eas` failed with
APP_NOT_INSTALLED. The route went into the deep link without percent-encoding,
so every route with a space or diacritics failed. A full URL such as
`cyclable://street/U Zeleného stromu` failed the same way.

Change: resolveDeepLinkUrl encodes the route once with encodeURI, keeps
escapes the caller already wrote, and keeps URL delimiters. A full URL gets
the same encoding for its authority and for the part after it; the authority
keeps `[` `]`, so an IPv6 host such as `exp://[::1]:8081` stays a host. Its
resolution now says the full URL was only percent-encoded. One it.each table
covers routes and full URLs; one test covers the Expo Go link. The LLP states
the rule, and tags the agent-device and Expo Router claims as observed. The
changelog has a bug-fix line.

Red before: the full-URL rows "cyclable://street/U Zeleného stromu",
"demoapp://Žižkov/x", "exp://[::1]:8081/--/street/U Z",
"exp://h/--/a b?q=a b#f g", "myapp:profile/Ž", and the two full-URL
resolution tests ("myapp://profile/42", "https://example.com/profile/42").
On main, also the route rows "/street/U Zeleného stromu" (scheme and Expo Go)
and "/street/Horní?x=a b&y=1#top".
Guard: "/street/U%20Zelen%C3%A9ho%20stromu" (no double encoding),
"/discount/50%" -> "50%25", "exp://[fe80::1%25en0]:8081" (zone kept), and
"exp+cyclable://expo-development-client/?url=http%3A%2F%2F…" (unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only an IPv6 host gets its `[` `]` back after encodeURI. Escapes the
caller wrote, %5B and %5D included, stay as written. Addresses Kudo's
review on #198.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vonovak
vonovak force-pushed the vonovak/fix-navigate-encode-route branch from d72a78c to 21cd022 Compare October 26, 2026 13:10
@vonovak
vonovak merged commit 54a5a16 into main Oct 26, 2026
18 checks passed
@vonovak
vonovak deleted the vonovak/fix-navigate-encode-route branch October 26, 2026 14:00
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.

2 participants