Skip to content

Commit 5163861

Browse files
authored
fix(bundler): escape potentially problematic strings in an XML (#9040)
* fix(bundler): escape potentially problematic strings in an XML (#9030) - replace characters invalid in XML with their escaped form to properly bundle resources with such characters in their pathnames. * change file
1 parent 80a215a commit 5163861

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changes/escape-paths-wix.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch:bug
3+
---
4+
5+
On Windows, fix building WiX installer when resources contains an XML charcter that should be escaped.

tooling/bundler/src/bundle/windows/msi/wix.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::bundle::{
1616
},
1717
};
1818
use anyhow::{bail, Context};
19-
use handlebars::{to_json, Handlebars};
19+
use handlebars::{html_escape, to_json, Handlebars};
2020
use log::info;
2121
use regex::Regex;
2222
use serde::{Deserialize, Serialize};
@@ -122,7 +122,7 @@ impl ResourceDirectory {
122122
r#"<Component Id="{id}" Guid="{guid}" Win64="$(var.Win64)" KeyPath="yes"><File Id="PathFile_{id}" Source="{path}" /></Component>"#,
123123
id = file.id,
124124
guid = file.guid,
125-
path = file.path.display()
125+
path = html_escape(&file.path.display().to_string())
126126
).as_str()
127127
);
128128
}
@@ -140,7 +140,7 @@ impl ResourceDirectory {
140140
format!(
141141
r#"<Directory Id="I{id}" Name="{name}">{files}{directories}</Directory>"#,
142142
id = Uuid::new_v4().as_simple(),
143-
name = self.name,
143+
name = html_escape(&self.name),
144144
files = files,
145145
directories = directories,
146146
)

0 commit comments

Comments
 (0)