diff --git a/src/snapshot_middleware/csv.rs b/src/snapshot_middleware/csv.rs index d55c0c55..16e2e582 100644 --- a/src/snapshot_middleware/csv.rs +++ b/src/snapshot_middleware/csv.rs @@ -10,6 +10,7 @@ use rbx_dom_weak::{types::Variant, ustr}; use serde::{Deserialize, Serialize}; use crate::{ + path_encoding::encode_path_name, snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot}, syncback::{FsSnapshot, SyncbackReturn, SyncbackSnapshot}, }; @@ -109,8 +110,13 @@ pub fn syncback_csv<'sync>( if !meta.is_empty() { let parent = snapshot.path.parent_err()?; + let meta_name = if snapshot.encode_windows_invalid_chars() { + encode_path_name(&new_inst.name) + } else { + new_inst.name.clone() + }; fs_snapshot.add_file( - parent.join(format!("{}.meta.json", new_inst.name)), + parent.join(format!("{}.meta.json", meta_name)), crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?, ) } diff --git a/src/snapshot_middleware/lua.rs b/src/snapshot_middleware/lua.rs index 5ed5fe35..9df87dde 100644 --- a/src/snapshot_middleware/lua.rs +++ b/src/snapshot_middleware/lua.rs @@ -8,6 +8,7 @@ use rbx_dom_weak::{ }; use crate::{ + path_encoding::encode_path_name, snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot}, syncback::{FsSnapshot, SyncbackReturn, SyncbackSnapshot}, }; @@ -158,8 +159,13 @@ pub fn syncback_lua<'sync>( if !meta.is_empty() { let parent_location = snapshot.path.parent_err()?; + let meta_name = if snapshot.encode_windows_invalid_chars() { + encode_path_name(&new_inst.name) + } else { + new_inst.name.clone() + }; fs_snapshot.add_file( - parent_location.join(format!("{}.meta.json", new_inst.name)), + parent_location.join(format!("{}.meta.json", meta_name)), crate::json::to_vec_pretty_sorted(&meta).context("cannot serialize metadata")?, ); } diff --git a/src/snapshot_middleware/txt.rs b/src/snapshot_middleware/txt.rs index f935b09b..089b2bde 100644 --- a/src/snapshot_middleware/txt.rs +++ b/src/snapshot_middleware/txt.rs @@ -6,6 +6,7 @@ use rbx_dom_weak::types::Variant; use rbx_dom_weak::ustr; use crate::{ + path_encoding::encode_path_name, snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot}, syncback::{FsSnapshot, SyncbackReturn, SyncbackSnapshot}, }; @@ -58,8 +59,13 @@ pub fn syncback_txt<'sync>( if !meta.is_empty() { let parent = snapshot.path.parent_err()?; + let meta_name = if snapshot.encode_windows_invalid_chars() { + encode_path_name(&new_inst.name) + } else { + new_inst.name.clone() + }; fs_snapshot.add_file( - parent.join(format!("{}.meta.json", new_inst.name)), + parent.join(format!("{}.meta.json", meta_name)), crate::json::to_vec_pretty_sorted(&meta).context("could not serialize metadata")?, ); }