fix: properly handle listing configuration, clear None from queries before pasing to redis

pull/494/head
Raphaël Vinot 2022-08-10 18:45:40 +02:00
parent e5ae22c3cc
commit be2e1ddc33
2 changed files with 4 additions and 3 deletions

View File

@ -64,10 +64,10 @@ class AsyncCapture(AbstractManager):
if get_config('generic', 'default_public'):
# 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:
# 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
headers: Dict[str, str] = {}

View File

@ -399,11 +399,12 @@ class Lookyloo():
if isinstance(value, bool):
query[key] = 1 if value else 0
elif isinstance(value, (list, dict)):
query[key] = json.dumps(value)
query[key] = json.dumps(value) if value else None
if 'document_name' in query:
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
hash_query = hashlib.sha512(pickle.dumps(query)).hexdigest()
# FIXME The line below should work, but it doesn't