Skip to content

Commit

Permalink
Merge pull request #289 from sam-masaki/imghash
Browse files Browse the repository at this point in the history
Use MD5 when naming image files
  • Loading branch information
rgaudin authored Jul 27, 2023
2 parents 86ac225 + e1009cc commit d02e8b2
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit d02e8b2

Please sign in to comment.