Skip to content

Commit 1573c72

Browse files
authored
fix: remove \\r from schema files on windows (#14561)
1 parent dd7e59a commit 1573c72

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changes/schema-carriage-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
tauri-utils: patch:bug
3+
---
4+
5+
Fixed an issue that caused schema files to have `\r` characters on Windows.

crates/tauri-utils/src/acl/schema.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ pub fn generate_capability_schema(
317317
extend_permission_entry_schema(&mut schema, acl);
318318

319319
let schema_str = serde_json::to_string_pretty(&schema).unwrap();
320+
// FIXME: in schemars@v1 this doesn't seem to be necessary anymore. If it is, find a better solution.
321+
let schema_str = schema_str.replace("\\r\\n", "\\n");
322+
320323
let out_dir = PathBuf::from(CAPABILITIES_SCHEMA_FOLDER_PATH);
321324
fs::create_dir_all(&out_dir)?;
322325

@@ -389,6 +392,9 @@ pub fn generate_permissions_schema<P: AsRef<Path>>(
389392

390393
let schema_str = serde_json::to_string_pretty(&schema)?;
391394

395+
// FIXME: in schemars@v1 this doesn't seem to be necessary anymore. If it is, find a better solution.
396+
let schema_str = schema_str.replace("\\r\\n", "\\n");
397+
392398
let out_dir = out_dir.as_ref().join(PERMISSION_SCHEMAS_FOLDER_NAME);
393399
fs::create_dir_all(&out_dir).map_err(|e| Error::CreateDir(e, out_dir.clone()))?;
394400

0 commit comments

Comments
 (0)