Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7124808
D48.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D48.diff
View Options
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
Details
Attached
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
Attached To
D48: Api fix
Event Timeline
Log In to Comment