Skip to content

Commit

Permalink
fix: Pandrora submit a downloaded file
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Feb 14, 2025
1 parent 6c030e2 commit 75c9bae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions website/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 %%%
Expand Down
2 changes: 1 addition & 1 deletion website/web/templates/hostname_popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ <h2 class="accordion-header">
<div>
{% if has_pandora %}
<div> Downloaded file: <b>{{url['url_object'].downloaded_filename}}</b> ({{sizeof_fmt(url['url_object'].downloaded_file.getbuffer().nbytes)}})</div>
{{ pandora_submit(tree_uuid, url['url_object'].uuid) }}
{{ pandora_submit(tree_uuid, url['url_object'].uuid, url['url_object'].downloaded_file_hash) }}
{% else %}
<a href="{{ url_for('data', tree_uuid=tree_uuid)}}">
Download {{url['url_object'].downloaded_filename}}
Expand Down

0 comments on commit 75c9bae

Please sign in to comment.