mirror of https://github.com/CIRCL/lookyloo
fix: properly handle listing configuration, clear None from queries before pasing to redis
parent
efe0bf9a4a
commit
7dc27d48b4
|
@ -64,10 +64,10 @@ class AsyncCapture(AbstractManager):
|
||||||
|
|
||||||
if get_config('generic', 'default_public'):
|
if get_config('generic', 'default_public'):
|
||||||
# By default, the captures are on the index, unless the user mark them as un-listed
|
# By default, the captures are on the index, unless the user mark them as un-listed
|
||||||
listing = False if ('listing' in to_capture and to_capture[b'listing'].lower() in [b'false', b'0', b'']) else True
|
listing = False if (b'listing' in to_capture and to_capture[b'listing'].lower() in [b'false', b'0', b'']) else True
|
||||||
else:
|
else:
|
||||||
# By default, the captures are not on the index, unless the user mark them as listed
|
# By default, the captures are not on the index, unless the user mark them as listed
|
||||||
listing = True if ('listing' in to_capture and to_capture[b'listing'].lower() in [b'true', b'1']) else False
|
listing = True if (b'listing' in to_capture and to_capture[b'listing'].lower() in [b'true', b'1']) else False
|
||||||
|
|
||||||
# Turn the freetext for the headers into a dict
|
# Turn the freetext for the headers into a dict
|
||||||
headers: Dict[str, str] = {}
|
headers: Dict[str, str] = {}
|
||||||
|
|
|
@ -399,11 +399,12 @@ class Lookyloo():
|
||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
query[key] = 1 if value else 0
|
query[key] = 1 if value else 0
|
||||||
elif isinstance(value, (list, dict)):
|
elif isinstance(value, (list, dict)):
|
||||||
query[key] = json.dumps(value)
|
query[key] = json.dumps(value) if value else None
|
||||||
|
|
||||||
if 'document_name' in query:
|
if 'document_name' in query:
|
||||||
query['document_name'] = secure_filename(query['document_name'])
|
query['document_name'] = secure_filename(query['document_name'])
|
||||||
|
|
||||||
|
query = {k: v for k, v in query.items() if v is not None} # Remove the none, it makes redis unhappy
|
||||||
# dirty deduplicate
|
# dirty deduplicate
|
||||||
hash_query = hashlib.sha512(pickle.dumps(query)).hexdigest()
|
hash_query = hashlib.sha512(pickle.dumps(query)).hexdigest()
|
||||||
# FIXME The line below should work, but it doesn't
|
# FIXME The line below should work, but it doesn't
|
||||||
|
|
Loading…
Reference in New Issue