Open-source personal finance manager. Self-hosted, privacy-first.
fix: strip marker chars (*/#) from CSV headers so the downloaded template auto-detects (#984)
Felype Nascimento375ebd917472
diff --git a/backend/app/services/asset_import_service.py b/backend/app/services/asset_import_service.pyindex 17672574..1ba30640 100644--- a/backend/app/services/asset_import_service.py+++ b/backend/app/services/asset_import_service.py@@ -205,7 +205,7 @@ def _normalize_header(value: str) -> str:Accents come off because a Brazilian export writes `Preço` and `Operação`,and a header that only differs by a diacritic is the same header."""- folded = _strip_accents(value.strip().lower().replace('_', ' '))+ folded = _strip_accents(value.strip().lower().replace('_', ' ').replace('*', '').replace('#', ''))return ' '.join(folded.split())diff --git a/backend/tests/test_asset_import_service.py b/backend/tests/test_asset_import_service.pyindex af2fa534..1bcfddb4 100644--- a/backend/tests/test_asset_import_service.py+++ b/backend/tests/test_asset_import_service.py@@ -68,6 +68,14 @@ def test_headers_are_recognised_without_a_mapping():assert orders[0].fee == Decimal("1.20")+def test_template_headers_are_auto_detected():+ """The downloaded template uses ticker* markers; they must not break detection."""+ content = b"ticker*,date*,quantity*,price*,fee,kind,currency,notes\nAAPL,2026-01-15,10,150.00,1.20,buy,USD,\n"+ orders, errors, _ = asset_import_service.parse_orders_csv(content)+ assert errors == []+ assert orders[0].ticker == "AAPL"++def test_portuguese_broker_headers_are_recognised():"""A Brazilian export names its columns in Portuguese and prices with commas."""orders, errors, _ = asset_import_service.parse_orders_csv(_csv(