diff --git a/scripts/render-per-user-wix.py b/scripts/render-per-user-wix.py index 80d08e5e..932dfb05 100755 --- a/scripts/render-per-user-wix.py +++ b/scripts/render-per-user-wix.py @@ -64,7 +64,7 @@ def registry_key(name: str) -> ET.Element: "RegistryValue", { "Root": "HKCU", - "Key": r"Software\{{@root.manufacturer}}\{{@root.product_name}}\Components", + "Key": r"Software\\{{@root.manufacturer}}\\{{@root.product_name}}\Components", "Name": name, "Type": "integer", "Value": "1", diff --git a/tests/test_windows_per_user_installer.py b/tests/test_windows_per_user_installer.py index 65de0e6e..16b4b5c7 100644 --- a/tests/test_windows_per_user_installer.py +++ b/tests/test_windows_per_user_installer.py @@ -166,3 +166,10 @@ def test_external_binary_guid_is_explicit_and_stable_across_builds(): assert first_guid == second.split(marker)[1].split(" Win64=")[0] assert '(eq bin.id "helper.exe")' in first_guid assert 'Guid="*"' not in marker + first_guid + + +def test_registry_key_template_does_not_escape_handlebars_expressions(): + key = _renderer().registry_key("MainBinary").attrib["Key"] + # A single backslash escapes the opening Handlebars delimiter. The canonical + # WiX template doubles it so the installed key uses resolved product names. + assert key == r"Software\\{{@root.manufacturer}}\\{{@root.product_name}}\Components"