diff --git a/swh/web/ui/views/api.py b/swh/web/ui/views/api.py --- a/swh/web/ui/views/api.py +++ b/swh/web/ui/views/api.py @@ -25,7 +25,7 @@ @app.route('/api/1/search/', methods=['POST']) @app.route('/api/1/search//') -def api_search(q): +def api_search(q=None): """Search a content per hash. Args: @@ -64,7 +64,7 @@ # Remove potential inputs with no associated value for k, v in data.items(): if v is not None: - if k == 'q': + if k == 'q' and len(v) > 0: queries.append({'filename': None, 'sha1': v}) elif v != '': queries.append({'filename': k, 'sha1': v})