fix: common (#3154)
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run

This commit is contained in:
shaohuzhang1 2025-05-28 10:13:47 +08:00 committed by GitHub
parent b45095f7ec
commit 129d52dff2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -280,7 +280,10 @@ def bulk_create_in_batches(model, data, batch_size=1000):
model.objects.bulk_create(batch)
def get_sha256_hash(_v: str):
def get_sha256_hash(_v: str | bytes):
sha256 = hashlib.sha256()
sha256.update(_v.encode())
if isinstance(_v, str):
sha256.update(_v.encode())
else:
sha256.update(_v)
return sha256.hexdigest()