question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistent decoding/encoding of params between server and client

See original GitHub issue

I have a link that contains a param that needs to be url-encoded, constructed using

<Link route="foo" params={{ bar: 'some / value' }}>
  <a>Foo</a>
</Link>

The <a> tag constructed as a result of this looks something like <a href="/foo/some%20%2F%20value">Foo</a>, which is what I would expect (params being encoded before injected in the url). If I go to this url through server-side rendering (e.g. command-click to open in a new tab), query.bar is the encoded string, "some%20%2F%20value". If I click this link to cause a client-side page load, query.bar is no longer encoded, "some / value".

I think the bug here is that the server-side should decode params before passing them down to query. That would make the behavior consistent with how next.js passes down regular query params as well (on the form ?foo=some%20value).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
jly36963commented, Feb 1, 2020

I am having the same issue:

onClick={() => Router.push(`/programs/?program=${encodeURIComponent(fetchedProgram.name)}`)}

onClick={() => Router.push({ pathname: '/programs/', query: { program: fetchedProgram.name }})}

The URI is not encoded following the client-side transition.

I get “Program 1” instead of “Program%201” in the URI.

0reactions
LefanTancommented, Dec 1, 2022

Same here

Read more comments on GitHub >

github_iconTop Results From Across the Web

SpringBoot urlencodes plus sign in query parameters in an ...
But in the first test, the client does not url-encode the plus character, but the server does url-decode it, hence it gets a...
Read more >
ProtoBuf decoding/encoding via Bytes.Decode.width?
The order of the fields of the record I am decoding to may be different to the ordering of the field numbers (i.e....
Read more >
draft-ietf-core-coap-15 - Constrained Application Protocol (CoAP)
Time Values derived from Transmission Parameters . ... Intermediary A CoAP endpoint that acts both as a server and as a client towards...
Read more >
Storage of advanced video coding (AVC) parameter sets in AVC file ...
There is provided a method for employing Parameter Set information corresponding to an Advanced Video Coding (AVC) file. The method includes the step...
Read more >
object of type is not json serializable
Lambda execution failed with status 200 due to customer function error: ... JSON (JavaScript Object Notation) is a lightweight data-interchange format.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found