fix: [api] /lookup fix if a UUID is allocated without data

main
Alexandre Dulaunoy 2021-05-27 10:38:07 +02:00
parent 8fd415134a
commit 87babe05f1
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 2 additions and 0 deletions

View File

@ -77,6 +77,8 @@ class lookup(Resource):
if not r.exists("u:{}".format(uuid)):
return{'message': 'Non existing UUID'}, 404
t = r.get("u:{}".format(uuid))
if not r.exists("{}:{}".format(t, uuid)):
return{'message': 'UUID allocated but no existing attributes'}, 404
h = r.hgetall("{}:{}".format(t, uuid))
h['_cycat_type'] = cycat_type[str(t)]
return (h)