From 54d778971df04c3255bf6e8fdeb42d26cb5e6f2c Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Sat, 18 Jul 2026 08:17:35 +0800 Subject: [PATCH] fix(storage): allow S3 without public_url, auto-construct path-style URL from endpoint --- app/storage.py | 4 +++- export_i18n.py | 21 --------------------- 2 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 export_i18n.py diff --git a/app/storage.py b/app/storage.py index d54dfcf..975e47b 100644 --- a/app/storage.py +++ b/app/storage.py @@ -120,7 +120,9 @@ class S3Storage: k = _strip_prefix(key) if self.public_url: return f"{self.public_url}/{k}" - return k + # fallback: path-style URL from endpoint + bucket + ep = self._client._endpoint.host + return f"{ep}/{self.bucket}/{k}" # ── Helpers ──────────────────────────────────────────────────────── diff --git a/export_i18n.py b/export_i18n.py deleted file mode 100644 index 9d6146b..0000000 --- a/export_i18n.py +++ /dev/null @@ -1,21 +0,0 @@ -"""One-time export: convert i18n.py translations to JSON files.""" -import json -from pathlib import Path - -from app.i18n import _translations - -locales_dir = Path(__file__).resolve().parent / "app" / "locales" -locales_dir.mkdir(exist_ok=True) - -langs: dict[str, dict[str, str]] = {} -for key, values in _translations.items(): - for lang, text in values.items(): - langs.setdefault(lang, {})[key] = text - -for lang, data in sorted(langs.items()): - out = locales_dir / f"{lang}.json" - with open(out, "w", encoding="utf-8") as f: - json.dump(data, f, ensure_ascii=False, indent=2) - print(f"Exported {len(data)} keys -> {out.name}") - -print("Done!")