Repository navigation
querystring.parse decodes incorrect in a specific case #13773
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.querystringIssues and PRs related to the built-in querystring module.Issues and PRs related to the built-in querystring module.
Description
Activity
- addedquerystringIssues and PRs related to the built-in querystring module.Issues and PRs related to the built-in querystring module.zlibIssues and PRs related to the zlib module and its compression dependencies.Issues and PRs related to the zlib module and its compression dependencies.and removedzlibIssues and PRs related to the zlib module and its compression dependencies.Issues and PRs related to the zlib module and its compression dependencies.
on Jun 19, 2017 Aside from the issue, it is generally recommended that you use the new
URLSearchParamsclass that parses query strings the exact same way browsers do, which is also faster thanquerystringmodule in almost all cases.Reacted by Tuan Anh TranAfter 5 hours of struggling with a an intermittent issue in the encoding of some of the POSTs received from our website, we tracked down the issue to this change in handling trailing spaces. The "random" nature of the issue was caused by the fact that some people submitted the form input with a trailing space.
So, is this a bug or an expected "changed behaviour" ???
There are a lot more problematic cases
// str v8.x v6.x expected 'af+' {} {} { 'af ': '' } 'af+&' {} { 'af ': '' } { 'af ': '' } REGRESSION '%20+' {} {} { ' ': '' } '%20+&' {} { ' ': '' } { ' ': '' } REGRESSION '+' {} {} { ' ': '' } '+&' {} { ' ': '' } { ' ': '' } REGRESSION
@jsilveira It is a bug.
- added a commit that references this issue
on Jul 10, 2017 - addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.
on Jul 10, 2017 - added 2 commits that reference this issue
on Jul 12, 2017 - added a commit that references this issue
on Jul 19, 2017 - added a commit that references this issue
on Jul 27, 2026
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.querystringIssues and PRs related to the built-in querystring module.Issues and PRs related to the built-in querystring module.
At Node 7.* or before, the result of
require('querystring').parse('a=%20+&')is{ a: ' ' }. However, at Node 8.0.0 or 8.1.2, the result ofrequire('querystring').parse('a=%20+&')is{ a: '%20 ' }.%20doesn't decode when it is before+.