fix: remove \\r from schema files on windows (#14561)

This commit is contained in:
Fabian-Lars
2025-11-26 11:22:45 +01:00
committed by GitHub
parent dd7e59a495
commit 1573c72402
2 changed files with 11 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
tauri-utils: patch:bug
---
Fixed an issue that caused schema files to have `\r` characters on Windows.

View File

@@ -317,6 +317,9 @@ pub fn generate_capability_schema(
extend_permission_entry_schema(&mut schema, acl);
let schema_str = serde_json::to_string_pretty(&schema).unwrap();
// FIXME: in schemars@v1 this doesn't seem to be necessary anymore. If it is, find a better solution.
let schema_str = schema_str.replace("\\r\\n", "\\n");
let out_dir = PathBuf::from(CAPABILITIES_SCHEMA_FOLDER_PATH);
fs::create_dir_all(&out_dir)?;
@@ -389,6 +392,9 @@ pub fn generate_permissions_schema<P: AsRef<Path>>(
let schema_str = serde_json::to_string_pretty(&schema)?;
// FIXME: in schemars@v1 this doesn't seem to be necessary anymore. If it is, find a better solution.
let schema_str = schema_str.replace("\\r\\n", "\\n");
let out_dir = out_dir.as_ref().join(PERMISSION_SCHEMAS_FOLDER_NAME);
fs::create_dir_all(&out_dir).map_err(|e| Error::CreateDir(e, out_dir.clone()))?;