mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
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
This commit is contained in:
5
.changes/escape-paths-wix.md
Normal file
5
.changes/escape-paths-wix.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-bundler": patch:bug
|
||||
---
|
||||
|
||||
On Windows, fix building WiX installer when resources contains an XML charcter that should be escaped.
|
||||
@@ -16,7 +16,7 @@ use crate::bundle::{
|
||||
},
|
||||
};
|
||||
use anyhow::{bail, Context};
|
||||
use handlebars::{to_json, Handlebars};
|
||||
use handlebars::{html_escape, to_json, Handlebars};
|
||||
use log::info;
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -122,7 +122,7 @@ impl ResourceDirectory {
|
||||
r#"<Component Id="{id}" Guid="{guid}" Win64="$(var.Win64)" KeyPath="yes"><File Id="PathFile_{id}" Source="{path}" /></Component>"#,
|
||||
id = file.id,
|
||||
guid = file.guid,
|
||||
path = file.path.display()
|
||||
path = html_escape(&file.path.display().to_string())
|
||||
).as_str()
|
||||
);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ impl ResourceDirectory {
|
||||
format!(
|
||||
r#"<Directory Id="I{id}" Name="{name}">{files}{directories}</Directory>"#,
|
||||
id = Uuid::new_v4().as_simple(),
|
||||
name = self.name,
|
||||
name = html_escape(&self.name),
|
||||
files = files,
|
||||
directories = directories,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user