From 0f019ac6ea287336efb78233c6d7b18941e663a0 Mon Sep 17 00:00:00 2001 From: d9pouces Date: Fri, 9 Oct 2026 20:22:26 +0200 Subject: [PATCH] feat: update repository names to support special characters in configuration files Signed-off-by: d9pouces --- tests/test_python.py | 12 ++++++------ uv.lock | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_python.py b/tests/test_python.py index fca967c..178c63c 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -78,7 +78,7 @@ def test_apply_single_repository(tmp_path) -> None: assert not (dst / "usr/lib").exists() -def test_apply_escapes_non_bmp_characters_as_valid_toml(tmp_path) -> None: +def test_apply_sanitizes_uv_index_name_with_non_bmp_characters(tmp_path) -> None: data = { "uuid": "12345678-1234-5678-1234-567812345678", "organisation": "InterDiode", @@ -97,12 +97,12 @@ def test_apply_escapes_non_bmp_characters_as_valid_toml(tmp_path) -> None: PythonModule().apply(context) uv_toml = (dst / "etc/uv/uv.toml").read_text(encoding="utf-8") - # json.dumps's default ensure_ascii=True would encode the emoji as a - # UTF-16 surrogate pair (😀), which is valid JSON but not - # valid TOML (TOML's \uXXXX must be a Unicode scalar value on its own). - assert '"demo 😀"' in uv_toml + # The emoji isn't a plain identifier character, so sanitize_repository_name + # replaces it (and the space before it) with "_", same as every other + # non-ASCII or syntax-breaking character. + assert '"demo__"' in uv_toml parsed = tomllib.loads(uv_toml) - assert parsed["index"][0]["name"] == "demo 😀" + assert parsed["index"][0]["name"] == "demo__" def test_apply_adds_trusted_host_for_non_https_repository(tmp_path) -> None: diff --git a/uv.lock b/uv.lock index 2dbdc9b..2f03325 100644 --- a/uv.lock +++ b/uv.lock @@ -424,7 +424,7 @@ dependencies = [ ] name = "id-configurator" source = {editable = "."} -version = "2026.10.6" +version = "2026.10.9" [package.dev-dependencies] dev = [