Skip to content

Ignore case when parsing probe_asn field #318

@hellais

Description

@hellais

Currently we strip the leading AS from the probe_asn field, but only if it's uppercase, see: https://github.com/ooni/api/blob/9349825b05b8006a476e8dbaf37e1d9aabf4fc69/measurements/api/measurements.py#L63.

In sentry we found the following stacktrace exception:


File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1838, in full_dispatch_request     rv = self.dispatch_request()   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1824, in dispatch_request     return self.view_functions[rule.endpoint](**req.view_args)   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/decorator.py", line 73, in wrapper     response = function(request)   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/uri_parsing.py", line 117, in wrapper     response = function(request)   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/validation.py", line 336, in wrapper     return function(request)   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/decorator.py", line 44, in wrapper     response = function(request)   File "/usr/local/lib/python3.7/site-packages/connexion/decorators/parameter.py", line 207, in wrapper     return function(**kwargs)   File "/app/measurements/api/measurements.py", line 357, in list_measurements     probe_asn = int(probe_asn)

We should rather be stripping the leading as in a case-insensitive way or tighten the rule for matching to avoid triggering an exception.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working correctlygood first issueGood for newcomersooni/apiIssues related to https://github.com/ooni/apipriority/lowNice to have

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions