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.

URI template encoding Bug in 10.x

See original GitHub issue

Hi.

Get http://localhost:8080/user/v1?userId=2020051417013580630000001&123

userId='2020051417013580630000001&123'

There is a ‘&’ symbol in the parameter causing segmentation error.

image

image

image

The actual received value is ‘2020051417013580630000001’ image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dalaoyangcommented, Dec 13, 2020

Has the problem been solved?

@R-anybbo

URLEncoder.encode(userId, "UTF-8")

0reactions
kdavisk6commented, Dec 29, 2020

Do we need to do it?

Simply put, yes. I recommend you look over the RFC referenced for the background.

And yes URLEncoder can help, but be careful when using it. It’s not designed to perform Percent Encoding, but to handle application/x-www-form-urlencoded values only, which are not the same as Percent Encoding.

Some great reading on the subject

Since you’ve found your solution, I’m going to close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'+' (plus sign) not encoded with RestTemplate using String url ...
6 to 2.1.2. We noticed, that when using RestTemplate, the '+' sign is not encoded to '%2B' anymore (changes by SPR-14828). This ...
Read more >
Spring Boot REST Template URI Encoding - DZone
Use Spring's Rest Template to consume encoded endpoints compared to hard coded endpoints. Hard coded endpoints are prone to ...
Read more >
URI Template RFC 6570 - IETF Datatracker
URI Template RFC 6570 · 1. Variable Expansion A variable that is undefined (Section 2.3) has no value and is ignored by the...
Read more >
Using URL encoding to handle special characters in a ...
While it is possible to load documents into MarkLogic Server, where the document URI contains special characters not encoded, it is recommended ...
Read more >
urlencode - Manual - PHP
This function is convenient when encoding a string to be used in a query part of a URL, as a convenient way to...
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