Page MenuHomeSoftware Heritage

D48.diff
No OneTemporary

D48.diff

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/<string:q>/')
-def api_search(q):
+def api_search(q=None):
"""Search a content per hash.
Args:
@@ -59,17 +59,20 @@
# Post form submission with many hash requests
elif request.method == 'POST':
+ import pprint
+ pprint.pprint(request.form)
data = request.form
queries = []
# 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})
if len(queries) > 0:
+ pprint.pprint(queries)
lookup = service.lookup_multiple_hashes(queries)
result = []
for el in lookup:

File Metadata

Mime Type
text/plain
Expires
Dec 21 2024, 8:12 PM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219837

Event Timeline