ContentMine / getpapers

Get metadata, fulltexts or fulltext URLs of papers matching a search query
MIT License
197 stars 37 forks source link

getpapers should not urlencode '&', '=', or '?' in its query URLs #178

Open sedimentation-fault opened 5 years ago

sedimentation-fault commented 5 years ago

Problem

In getpapers/lib/arxiv.js we see:

var queryurl = arxiv.baseurl + encodeURIComponent(query)

Using encodeURIComponent is overkill here, it will 'urlencode' all characters of query, including '&', '?' and others. According to my understanding of the HTTP protocol, this is even plain wrong.

Solution

Use encodeURI instead:

var queryurl = arxiv.baseurl + encodeURI(query)