bartve / disconnect

An easy to use Node.js client with OAuth support to connect with the discogs.com API v2.0
MIT License
457 stars 79 forks source link

Search URI encoding #17

Closed aemixdp closed 9 years ago

aemixdp commented 9 years ago

Currently database.search uses util.escape and util.addParams (with querystring.stringify inside) to encode a request URI. At least on my PC this results into wrong encoding for which discogs always returns zero results. For example, the query Theory & DanJah Wise - Tribulation gets encoded as /database/search?q=Theory%2520%2526%2520DanJah%2520Wise%2520-%2520Tribulation. When I change it to

client.get({url: "/database/search?q=" + encodeURIComponent(query), authLevel: 1}, callback);

it encodes as /database/search?q=Theory%20%26%20DanJah%20Wise%20-%20Tribulation and everything works fine (discogs returns a result).

bartve commented 9 years ago

Woops! Double encoding indeed. Will get this fixed ASAP.

bartve commented 9 years ago

Should be fixed in 0.6.7