style: black格式化storage.py
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 20s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m2s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 37s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m10s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 39s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 3m45s
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 25s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m25s
AI Code Review / AI Code Review (pull_request) Successful in 3m40s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 5m25s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 11m21s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 4m21s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 8m7s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 34m3s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 11s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1299h13m7s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 1299h42m49s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1299h43m7s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1299h42m51s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1299h42m53s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 1299h58m5s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 1299h58m25s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 1299h58m27s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 1299h58m31s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 1300h25m24s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 1300h25m26s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 1300h30m55s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 1300h57m52s

This commit is contained in:
CI Bot
2026-07-24 10:47:36 +08:00
parent b5bc22834c
commit 848705a67d
+4 -12
View File
@@ -98,9 +98,7 @@ class SharedStorageService(StoragePort):
def diagnose(self) -> None:
"""输出存储配置诊断日志。"""
key_id_display = (
f"{self.access_key_id[:4]}...{self.access_key_id[-4:]}"
if len(self.access_key_id) > 8
else "(empty)"
f"{self.access_key_id[:4]}...{self.access_key_id[-4:]}" if len(self.access_key_id) > 8 else "(empty)"
)
logger.info(
"[OSS诊断] endpoint=%s bucket_name=%s access_key_id=%s",
@@ -156,9 +154,7 @@ class SharedStorageService(StoragePort):
try:
if isinstance(file_or_path, (str, Path)):
self.bucket.put_object_from_file(
storage_key, str(file_or_path), headers={"Content-Type": content_type}
)
self.bucket.put_object_from_file(storage_key, str(file_or_path), headers={"Content-Type": content_type})
else:
file_or_path.seek(0) # type: ignore[attr-defined]
self.bucket.put_object(storage_key, file_or_path, headers={"Content-Type": content_type})
@@ -282,9 +278,7 @@ class SharedStorageService(StoragePort):
logger.error("OSS not configured, cannot download: %s", asset_storage_key[:80])
return False
try:
self.bucket.get_object_to_file(
self._normalize_storage_key(asset_storage_key), str(local_path)
)
self.bucket.get_object_to_file(self._normalize_storage_key(asset_storage_key), str(local_path))
return local_path.exists() and local_path.stat().st_size > 0
except Exception:
logger.exception("下载素材失败: %s", asset_storage_key)
@@ -375,9 +369,7 @@ class SharedStorageService(StoragePort):
],
],
}
encoded_policy = base64.b64encode(
json.dumps(policy, separators=(",", ":")).encode("utf-8")
).decode("ascii")
encoded_policy = base64.b64encode(json.dumps(policy, separators=(",", ":")).encode("utf-8")).decode("ascii")
signature = base64.b64encode(
hmac.new(
self.access_key_secret.encode("utf-8"),