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.

QueryStringDecoder does not decode correctly path part with '+' (plus) sign in it

See original GitHub issue

Expected behavior

‘+’ is a valid char for path part of URI, it should not be replaced by space.

Actual behavior

‘+’ is replaced with space.

Steps to reproduce

Minimal yet complete reproducer code (or URL to code)

public void testURIPathDecoding() throws URISyntaxException {
    String path = "/a/path/with/a+in.it";
    URI uri = new URI("http", "www.bbbb.com", path, null);
    System.out.println(path.equals(uri.getPath()));
    System.out.println(path.equals(uri.getRawPath()));
    QueryStringDecoder dec = new QueryStringDecoder(uri.getRawPath());
    System.out.println(dec.path());
    System.out.println(path.equals(dec.path()));
    System.out.println(path.equals(dec.uri()));
  }

true
true
/a/path/with/a in.it
false
true

Netty version

4.1.11

JVM version (e.g. java -version)

OS version (e.g. uname -a)

Any

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
fenik17commented, May 22, 2017

Found one more problem: a charset does not work as intended… Code

System.out.println(new URI("случайный%20праздник").getPath());
System.out.println(QueryStringDecoder.decodeComponent("случайный%20праздник"));
System.out.println(QueryStringDecoder.decodeComponent("случайный праздник"));

return

случайный праздник
A;CG09=K9 ?@074=8:
случайный праздник

I’ll try to fix this too.

0reactions
Scottmitchcommented, Jun 13, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

QueryStringDecoder (Netty API Reference (4.1.85.Final))
Splits an HTTP query string into a path string and key-value parameter pairs. This decoder is for one time use only. Create a...
Read more >
File.toURI does not encode plus sign - java - Stack Overflow
It treat the '+' plus as encoded character and hence decode it to ... toURI does not encode + sign in path part...
Read more >
Stardog Platform Release Notes | Stardog Documentation 7.8.3
Multiline queries passed to CLI explain are now correctly parsed. Inconsistent usage of base URI used for parsing when one is not specified...
Read more >
playframework/playframework - Gitter
https://netty.io/4.0/api/io/netty/handler/codec/http/QueryStringDecoder.html. lemme look ... Is there any way to get the request time from a play.api.mvc.
Read more >
Guide to Java URL Encoding/Decoding - Baeldung
For example, a “+” sign is a valid character in path segments and therefore should not be encoded. To encode the path segment,...
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