adsabs / adsabs-dev-api

Developer API service description and example client code
163 stars 58 forks source link

Handle non-url encoded characters gracefully #15

Open aaccomazzi opened 8 years ago

aaccomazzi commented 8 years ago

Currently this query to the search API produces a 500 error:

https://api.adsabs.harvard.edu/v1/search/query?q=full:"foo"

However, this one works fine:

https://api.adsabs.harvard.edu/v1/search/query?q=full:%22foo%22

The only difference here is that the double quotes have been hex-encoded.

jonnybazookatone commented 8 years ago

Most likely related to the monkeypatch, such that this is not accepted by the oauth module as an acceptable character.

aaccomazzi commented 8 years ago

Is anybody other than me annoyed by this? I can't quite understand why the oauth module is so strict, and makes me wonder if there should be a normalization of the input query string ahead of its handling the request.

romanchyla commented 8 years ago

But quotes have to be escaped, unless I'm wrong, of course. When I use curl it fails too. I will check though On Oct 14, 2015 9:37 AM, "Alberto Accomazzi" notifications@github.com wrote:

Is anybody other than me annoyed by this? I can't quite understand why the oauth module is so strict, and makes me wonder if there should be a normalization of the input query string ahead of its handling the request.

— Reply to this email directly or view it on GitHub https://github.com/adsabs/adsabs-dev-api/issues/15#issuecomment-148051277 .

aaccomazzi commented 8 years ago

I don't see the double quote character listed in the reserved set on this page: https://en.wikipedia.org/wiki/Percent-encoding

But either way, my general impression is that the oauth module we are using is overly restrictive, and don't quite understand why. The fact that we have to monkey-patch it is disturbing to me and makes me wonder whether I'm missing something.