Skip to content

fix: encode params in generateMetadata to match page components#95356

Draft
icyJoseph wants to merge 4 commits into
canaryfrom
test/params-encoding-consistency-95343
Draft

fix: encode params in generateMetadata to match page components#95356
icyJoseph wants to merge 4 commits into
canaryfrom
test/params-encoding-consistency-95343

Conversation

@icyJoseph

@icyJoseph icyJoseph commented Jul 1, 2026

Copy link
Copy Markdown
Member

For a route like /products/foo%20bar, await params gave the page "foo%20bar" (encoded) but generateMetadata decoded it "foo bar".

PR #90249 accidentally made metadata read interpolatedParams raw, skipping the encodeURIComponent the page path applies.

This fix, run metadata's param values through the same encoding (encodeParamValue) in resolve-metadata.ts. Now both sides return "foo%20bar". Which is was the behavior in 16.1.

This is of course assuming we don't want do "foo bar".

Proposed fix for: #95343

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Stats cancelled

Commit: f666d38
View workflow run

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Failing CI jobs

Commit: f666d38 | About building and testing Next.js

@icyJoseph icyJoseph force-pushed the test/params-encoding-consistency-95343 branch from ffac9ff to f21de49 Compare July 1, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant