diff --git a/swh/web/common/service.py b/swh/web/common/service.py --- a/swh/web/common/service.py +++ b/swh/web/common/service.py @@ -89,6 +89,7 @@ """ algo, hash = query.parse_hash(q) found = storage.content_find({algo: hash}) + found = found[0] if found else None return {'found': converters.from_content(found), 'algo': algo} @@ -104,7 +105,7 @@ """ algo, hash = query.parse_hash(q) found = storage.content_find({algo: hash}) - return {'found': found is not None} + return {'found': bool(found)} def _lookup_content_sha1(q): @@ -122,7 +123,7 @@ hashes = storage.content_find({algo: hash}) if not hashes: return None - return hashes['sha1'] + return hashes[0]['sha1'] return hash @@ -718,6 +719,7 @@ directory_entries))} elif entity['type'] == 'file': # content content = storage.content_find({'sha1_git': entity['target']}) + content = content[0] if content else None if with_data: c = _first_element(storage.content_get([content['sha1']])) content['data'] = c['data'] @@ -751,7 +753,7 @@ if not c: raise NotFoundExc('Content with %s checksum equals to %s not found!' % (algo, hashutil.hash_to_hex(hash))) - return converters.from_content(c) + return converters.from_content(c[0]) def lookup_content_raw(q):