Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle non-urlencoded commas with selection "|=" OR filters #10

Open
bjamesvERT opened this issue Feb 14, 2019 · 2 comments
Open

handle non-urlencoded commas with selection "|=" OR filters #10

bjamesvERT opened this issue Feb 14, 2019 · 2 comments

Comments

@bjamesvERT
Copy link
Contributor

The web API defaults to a secure (and generic/unclear) HTTP 500 error when a Selection "|=" filter is typed with a non-URLEncoded comma.

API should recognize the syntax Exception and display a specific, informative HTTP 400 error - instructing the user that "|=" filter is the problem (and possibly how to correct it)

Example query: http://www.nwfsc.noaa.gov/data/api/v1/source/trawl.catch_fact/selection.json?filters=date_dim$year%7C=[%221999%22,%222000%22]

@bjamesvERT
Copy link
Contributor Author

The internally-logged (secure) Apache error message:

[Wed Jun 08 08:03:36 2016] [error] [client {IP_REMOVED}]     str_values = json.loads( str_right)
[Wed Jun 08 08:03:36 2016] [error] [client {IP_REMOVED}]   File "/var/www/wsgi-scripts/warehouse/miniconda3/envs/warehouse-env/lib/python3.4/site-packages/simplejson/__init__.py", line 516, in loads
[Wed Jun 08 08:03:36 2016] [error] [client {IP_REMOVED}]     return _default_decoder.decode(s)
[Wed Jun 08 08:03:36 2016] [error] [client {IP_REMOVED}]   File "/var/www/wsgi-scripts/warehouse/miniconda3/envs/warehouse-env/lib/python3.4/site-packages/simplejson/decoder.py", line 370, in decode
[Wed Jun 08 08:03:36 2016] [error] [client {IP_REMOVED}]     obj, end = self.raw_decode(s)
[Wed Jun 08 08:03:36 2016] [error] [client {IP_REMOVED}]   File "/var/www/wsgi-scripts/warehouse/miniconda3/envs/warehouse-env/lib/python3.4/site-packages/simplejson/decoder.py", line 400, in raw_decode
[Wed Jun 08 08:03:36 2016] [error] [client {IP_REMOVED}]     return self.scan_once(s, idx=_w(s, idx).end())
[Wed Jun 08 08:03:36 2016] [error] [client {IP_REMOVED}] simplejson.scanner.JSONDecodeError: Expecting ',' delimiter or ']': line 1 column 8 (char 7)```

@bjamesvERT
Copy link
Contributor Author

non-URLEncoded comma should either be supported, or give a better error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant