Skip to content

Commit a476313

Browse files
authored
Escape content could be problematic for XML (#54)
1 parent 3d4ba0b commit a476313

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

cookiecutter.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"python_version": "3.X.0",
2020
"_extensions": [
2121
"briefcase.integrations.cookiecutter.PythonVersionExtension",
22-
"briefcase.integrations.cookiecutter.UUIDExtension"
22+
"briefcase.integrations.cookiecutter.UUIDExtension",
23+
"briefcase.integrations.cookiecutter.XMLExtension"
2324
]
2425
}

{{ cookiecutter.format }}/{{ cookiecutter.app_name }}.wxs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
22
<Package
33
UpgradeCode="{{ cookiecutter.guid }}"
4-
Name="{{ cookiecutter.formal_name }}"
4+
Name="{{ cookiecutter.formal_name|xml_escape }}"
55
Version="{{ cookiecutter.version_triple }}"
6-
Manufacturer="{{ cookiecutter.author or 'Anonymous' }}"
6+
Manufacturer="{{ (cookiecutter.author or 'Anonymous')|xml_escape }}"
77
Language="1033"
88
Scope="{{ 'perUserOrMachine' if 'User' in cookiecutter.install_scope else 'perMachine' }}">
99
<!-- See scope comments below -->
1010

1111
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
1212

13-
<Icon Id="ProductIcon" SourceFile="{{ cookiecutter.formal_name }}/icon.ico" />
13+
<Icon Id="ProductIcon" SourceFile="{{ cookiecutter.formal_name|xml_escape }}/icon.ico" />
1414

1515
<!-- Add/Remove Programs settings -->
1616
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
1717
{% if cookiecutter.url -%}
18-
<Property Id="ARPURLINFOABOUT" Value="{{ cookiecutter.url }}" />
18+
<Property Id="ARPURLINFOABOUT" Value="{{ cookiecutter.url|xml_escape }}" />
1919
{% endif -%}
2020
{% if cookiecutter.author_email -%}
2121
<Property Id="ARPCONTACT" Value="{{ cookiecutter.author_email }}" />
@@ -34,9 +34,9 @@
3434
depending on the values of the ALLUSERS and MSIINSTALLPERUSER properties. -->
3535
<StandardDirectory Id="ProgramFiles64Folder">
3636
{%- if cookiecutter.use_full_install_path %}
37-
<Directory Name="{{ cookiecutter.author or 'Unknown Developer' }}">
37+
<Directory Name="{{ (cookiecutter.author or 'Unknown Developer')|xml_escape }}">
3838
{%- endif %}
39-
<Directory Id="INSTALLFOLDER" Name="{{ cookiecutter.formal_name }}" />
39+
<Directory Id="INSTALLFOLDER" Name="{{ cookiecutter.formal_name|xml_escape }}" />
4040
{%- if cookiecutter.use_full_install_path %}
4141
</Directory>
4242
{%- endif %}
@@ -46,21 +46,21 @@
4646
<!-- "\\?\" enables long paths (https://github.com/wixtoolset/issues/issues/9115). -->
4747
<Files
4848
Directory="INSTALLFOLDER"
49-
Include="\\?\{{ cookiecutter.package_path }}\**" />
49+
Include="\\?\{{ cookiecutter.package_path|xml_escape }}\**" />
5050
</ComponentGroup>
5151

5252
<StandardDirectory Id="ProgramMenuFolder">
53-
<Directory Id="ProgramMenuSubfolder" Name="{{ cookiecutter.formal_name }}">
53+
<Directory Id="ProgramMenuSubfolder" Name="{{ cookiecutter.formal_name|xml_escape }}">
5454
<Component Id="ApplicationShortcuts">
5555
<Shortcut
5656
Id="ApplicationShortcut1"
57-
Name="{{ cookiecutter.formal_name }}"
57+
Name="{{ cookiecutter.formal_name|xml_escape }}"
5858
Icon="ProductIcon"
5959
Description="{{ cookiecutter.description | truncate(256, False) }}"
6060
Target="[INSTALLFOLDER]{{ cookiecutter.binary_path }}" />
6161
<RegistryValue
6262
Root="HKMU"
63-
Key="Software\{{ cookiecutter.author or 'Unknown Developer' }}\{{ cookiecutter.formal_name }}"
63+
Key="Software\{{ (cookiecutter.author or 'Unknown Developer')|xml_escape }}\{{ cookiecutter.formal_name|xml_escape }}"
6464
Name="installed"
6565
Type="integer"
6666
Value="1"
@@ -81,15 +81,15 @@
8181
Id="FileAssociation.{{ document_type_id }}"
8282
Directory="INSTALLFOLDER">
8383
<File
84-
Id="ProductIcon.{{ document_type_id }}"
85-
Source="{{ cookiecutter.app_name }}-{{ document_type_id }}.ico" />
84+
Id="ProductIcon.{{ document_type_id|xml_escape }}"
85+
Source="{{ cookiecutter.app_name }}-{{ document_type_id|xml_escape }}.ico" />
8686
<ProgId
87-
Id="{{ cookiecutter.bundle }}.{{ cookiecutter.app_name }}.{{ document_type_id }}"
88-
Description="{{ document_type.description }}"
87+
Id="{{ cookiecutter.bundle }}.{{ cookiecutter.app_name }}.{{ document_type_id|xml_escape }}"
88+
Description="{{ document_type.description|xml_escape }}"
8989
Icon="ProductIcon.{{ document_type_id }}">
9090
<Extension
9191
Id="{{ document_type.extension }}"
92-
ContentType="{% if document_type.get('mime_type') %}{{ document_type.mime_type }}{% else %}application/x-{{ cookiecutter.app_name }}-{{ document_type_id }}{% endif %}">
92+
ContentType="{% if document_type.get('mime_type') %}{{ document_type.mime_type|xml_escape }}{% else %}application/x-{{ cookiecutter.app_name }}-{{ document_type_id }}{% endif %}">
9393
<Verb
9494
Id="open"
9595
Command="Open"

0 commit comments

Comments
 (0)