Commit 806135b
Changed files (1)
src
src/database.py
@@ -79,11 +79,11 @@ async def get_cf_kv(key: str, *, log_success: bool = True) -> dict:
return {}
-async def list_cf_r2(prefix: str = "", continuation_token: str | None = None) -> dict:
+async def list_cf_r2(prefix: str = "", continuation_token: str | None = None) -> tuple[bool, dict]:
"""Get from Cloudflare R2."""
if not DB.CF_R2_ENABLED:
logger.warning("SKIP LIST CF-R2: Cloudflare R2 disabled")
- return {}
+ return False, {}
async with Session().client(
service_name="s3",
endpoint_url=f"https://{DB.CF_ACCOUNT_ID}.r2.cloudflarestorage.com",
@@ -97,10 +97,10 @@ async def list_cf_r2(prefix: str = "", continuation_token: str | None = None) ->
if prefix:
payload["Prefix"] = prefix
try:
- return await s3.list_objects_v2(**payload)
+ return True, await s3.list_objects_v2(**payload)
except Exception as e:
logger.warning(f"List CF-R2 failed for {prefix=}: {e}")
- return {}
+ return False, {}
async def get_cf_r2(key: str) -> dict: