fix: [api/md5] if there is already more data in default SHA1 we use that one and not the fall-back MD5 lookup

This commit is contained in:
Alexandre Dulaunoy 2021-09-01 19:56:50 +02:00
parent fe04f1e7dd
commit 74c0e8c8c2
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -100,7 +100,7 @@ class lookup(Resource):
session_key = "session:{}:exist".format(request.headers.get('hashlookup_session'))
rdb.sadd(session_key, k)
rdb.expire(session_key, ttl)
if rdb.exists("h:{}".format(k)):
if rdb.exists("h:{}".format(k)) and not rdb.exists("l:{}".format(k)):
h = rdb.hgetall("h:{}".format(k))
sha1 = k
else: