Kong / Kong/unirest-nodejs

query() incorrectly replacing all back slashes to forward slashes

Open
#77 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
953
Forks
164
PR merge metrics
No merged PRs in 30d

Description

It makes sense for query() to replace something like "http:\\google.com" to "http://google.com", but it doesn't make sense for it to replace the querystring portion as well:

Input: "http:\\google.com?q=hyphens\-escaped\-in\-solr\-like\-this"
Desired Output: "http://google.com?q=hyphens%5C-escaped%5C-in%5C-solr%5C-like%5C-this"
Actual Output: "http://google.com?q=hyphens/-escaped/-in/-solr/-like/-this"

When making a request to a solr instance in this case, it malforms the request. I had attempted to use querystring parse and stringify to repack the request already url encoded with limited success - it worked for the one case but broke other cases. My workaround in the end was to simply replace the one character to %5C manually - ugly but works for now.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the query() URL-normalization entry point and reproduce the supplied Solr-like input. Trace where backslashes in the querystring are converted, then verify that URL backslashes become forward slashes while querystring backslashes are encoded as %5C, matching the desired output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.