From 4996ff7432dc7c5e3bb3e67d0584e6b0a919cbfd Mon Sep 17 00:00:00 2001 From: Barcode Betty Date: Sat, 4 Apr 2026 06:31:48 +0000 Subject: [PATCH] fix(api): escape percent signs in alembic database URL for configparser CNPG-generated passwords containing URL-encoded chars (e.g. %2B, %2F) cause configparser.BasicInterpolation to fail with "invalid interpolation syntax". Escaping % as %% prevents this. Co-Authored-By: Paperclip --- api/alembic/env.py | 2 +- common/alembic/env.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/alembic/env.py b/api/alembic/env.py index 3e563e1..694d4dc 100644 --- a/api/alembic/env.py +++ b/api/alembic/env.py @@ -18,7 +18,7 @@ if not db_url: "CARTSNITCH_DATABASE_URL_SYNC must be set. " "Example: postgresql://user:pass@localhost:5432/cartsnitch" ) -config.set_main_option("sqlalchemy.url", db_url) +config.set_main_option("sqlalchemy.url", db_url.replace("%", "%%")) target_metadata = Base.metadata diff --git a/common/alembic/env.py b/common/alembic/env.py index cd893e0..7cbf061 100644 --- a/common/alembic/env.py +++ b/common/alembic/env.py @@ -14,7 +14,7 @@ if config.config_file_name is not None: db_url = os.environ.get("CARTSNITCH_DATABASE_URL_SYNC") if db_url: - config.set_main_option("sqlalchemy.url", db_url) + config.set_main_option("sqlalchemy.url", db_url.replace("%", "%%")) target_metadata = Base.metadata