-
Notifications
You must be signed in to change notification settings - Fork 151
[BUG] Malformed UTF-8 Characters in Query Parameters starting from v3.5.6 #854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As stated in the Discord thread the issue is the
It should be encoded, which it is not |
It seems to be this function: opennextjs-aws/packages/open-next/src/core/routing/util.ts Lines 126 to 137 in 9411b7a
In the versions prior to |
Yeah, you can't just revert to |
This PR had this line:
If I add it back and also have this as export function convertToQueryString(query: Record<string, string | string[]>) {
const searchParams = new URLSearchParams();
Object.entries(query).forEach(([key, value]) => {
if (Array.isArray(value)) {
value.forEach((entry) => searchParams.append(key, decodeURIComponent(entry)));
} else {
searchParams.append(key, decodeURIComponent(value));
}
});
const queryString = searchParams.toString();
return queryString.length > 0 ? `?${queryString}` : "";
} E2E runs fine, but one unit test will fail:
However, if you have a redirect with this: const nextConfig: NextConfig = {
redirects: async () => [
{
source: '/baby',
destination: '/foo?bar=value%201&bar=value2+something+else&baz=value3',
permanent: false,
},
],
}; it will give you a |
Bug Report: Malformed UTF-8 Characters in Query Parameters in v3.5.6
Description
After v3.5.6, UTF-8 characters (e.g., Nordic characters like
äöå
) in query parameters are being malformed into � in deployed environments. This issue only occurs when navigating within the application to a cached page with UTF-8 encoded query parameters. Reverting to v3.5.5 resolves the issue.The issue is specific to deployed environments and is not reproducible locally, making debugging and reproduction more challenging.
Expected Behavior
When navigating to a page with UTF-8 encoded URL parameters, the request should return:
q=äää
.Example:
GET /search?q=äää Response: 304 Not Modified Query: q=äää
Actual Behavior
Instead of returning the cached page, navigating to a cached page results in a redirect along with malformed query parameters:
Malformed Example:
Steps to Reproduce
/search?q=äöå€
using the bottom button (direct navigation from URL works)Minimal Reproduction
Discord Discussion
For additional context, see the ongoing thread on Discord:
https://discord.com/channels/1283128968140161065/1286094576788177059/1367919144694972569
Reproduction Environment
Manually tested that v3.5.6 is the breaking update.
EDIT: Added a more minimal reproduction repo and deployed it. Links and steps updated.
The text was updated successfully, but these errors were encountered: