Commit 8845ccc

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-01-30 14:18:32
fix(R2): disable checksum validation because of compatibility
1 parent 34c298b
Changed files (1)
src/database.py
@@ -6,6 +6,7 @@ Note: Memory Cache is always enabled.
 """
 
 import json
+import os
 from urllib.parse import quote_plus, unquote_plus
 
 from aioboto3 import Session
@@ -16,6 +17,10 @@ from loguru import logger
 from config import DB, cache
 from utils import bare_url, stringfy
 
+# hot fix: https://developers.cloudflare.com/r2/examples/aws/boto3/
+os.environ["AWS_REQUEST_CHECKSUM_CALCULATION"] = "when_required"
+os.environ["AWS_RESPONSE_CHECKSUM_VALIDATION"] = "when_required"
+
 
 async def get_db(key: str) -> dict:
     """Get KV."""