From 75c9bae0a7c436e4566bcd995dadf9a912866301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 14 Feb 2025 13:48:28 +0100 Subject: [PATCH] fix: Pandrora submit a downloaded file --- website/web/__init__.py | 3 +++ website/web/templates/hostname_popup.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/website/web/__init__.py b/website/web/__init__.py index 7237ddd9..e40806e0 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -687,6 +687,9 @@ def normalize_known_content(h: str, /, known_content: dict[str, Any], url: URLNo 'url_object': url, } + if hasattr(url, 'downloaded_file') and url.downloaded_file: + url.add_feature('downloaded_file_hash', hashlib.sha512(url.downloaded_file.getvalue()).hexdigest()) + if not url.empty_response: # Index lookup # %%% Full body %%% diff --git a/website/web/templates/hostname_popup.html b/website/web/templates/hostname_popup.html index be4a108f..b99065c2 100644 --- a/website/web/templates/hostname_popup.html +++ b/website/web/templates/hostname_popup.html @@ -292,7 +292,7 @@

{% if has_pandora %}
Downloaded file: {{url['url_object'].downloaded_filename}} ({{sizeof_fmt(url['url_object'].downloaded_file.getbuffer().nbytes)}})
- {{ pandora_submit(tree_uuid, url['url_object'].uuid) }} + {{ pandora_submit(tree_uuid, url['url_object'].uuid, url['url_object'].downloaded_file_hash) }} {% else %} Download {{url['url_object'].downloaded_filename}}