Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MD5 when naming image files #289

Merged
merged 4 commits into from
Jul 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/sotoki/utils/imager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import io
import re
import zlib
import hashlib
import urllib.parse
from typing import Optional

Expand Down Expand Up @@ -153,7 +153,8 @@ def get_s3_key_for(self, url: str) -> str:

def get_digest_for(self, url: str) -> str:
"""Unique identifier of that url"""
return zlib.adler32(url.encode("UTF-8"))
return hashlib.md5(url.encode("UTF-8")).hexdigest() # nosec


def get_version_ident_for(self, url: str) -> str:
"""~version~ of the URL data to use for comparisons. Built from headers"""
Expand Down