fix: Avoid invalid URL chars in filename

pull/497/head
Raphaël Vinot 2022-08-05 15:45:46 +02:00
parent 87be90af83
commit c9a5adc066
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,7 @@ from PIL import Image, UnidentifiedImageError
from pymisp import MISPAttribute, MISPEvent, MISPObject
from redis import ConnectionPool, Redis
from redis.connection import UnixDomainSocketConnection
from werkzeug.utils import secure_filename
from .capturecache import CaptureCache, CapturesIndex
from .context import Context
@ -400,6 +401,9 @@ class Lookyloo():
elif isinstance(value, (list, dict)):
query[key] = json.dumps(value)
if 'document_name' in query:
query['document_name'] = secure_filename(query['document_name'])
# dirty deduplicate
hash_query = hashlib.sha512(pickle.dumps(query)).hexdigest()
# FIXME The line below should work, but it doesn't