mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Add syncback_encoded_names fixture and related tests for encoded name handling
- Introduced a new fixture `syncback_encoded_names` with various scripts and models demonstrating encoded characters in names, including `What%QUESTION%Module` and `Key%COLON%Script`. - Added tests to validate the correct handling of encoded names during directory conversions, ensuring that the filesystem names match the expected encoded formats. - Updated `change_processor.rs` and `api.rs` to improve file handling and metadata management related to encoded names, enhancing overall robustness and consistency in operations.
This commit is contained in:
parent
1edca38c34
commit
9c92204956
8 changed files with 342 additions and 26 deletions
|
|
@ -2276,12 +2276,9 @@ impl ApiService {
|
|||
// in-place JSON property updates. Other file types (.txt, .csv, .toml,
|
||||
// .yaml, etc.) require an adjacent .meta.json5 file — writing JSON
|
||||
// directly to them would corrupt their content.
|
||||
let file_name = inst_path
|
||||
.file_name()
|
||||
.and_then(|f| f.to_str())
|
||||
.unwrap_or("");
|
||||
let is_model_file = file_name.ends_with(".model.json5")
|
||||
|| file_name.ends_with(".model.json");
|
||||
let file_name = inst_path.file_name().and_then(|f| f.to_str()).unwrap_or("");
|
||||
let is_model_file =
|
||||
file_name.ends_with(".model.json5") || file_name.ends_with(".model.json");
|
||||
|
||||
if is_model_file {
|
||||
let meta = self.merge_or_build_meta(
|
||||
|
|
@ -2303,14 +2300,10 @@ impl ApiService {
|
|||
} else {
|
||||
// For .txt, .csv, .toml, .yaml, etc. — use adjacent meta file
|
||||
let parent_dir = inst_path.parent().context("No parent directory")?;
|
||||
let file_stem = inst_path
|
||||
.file_stem()
|
||||
.and_then(|s| s.to_str())
|
||||
.unwrap_or("");
|
||||
let file_stem = inst_path.file_stem().and_then(|s| s.to_str()).unwrap_or("");
|
||||
let meta_path = parent_dir.join(format!("{}.meta.json5", file_stem));
|
||||
|
||||
let meta =
|
||||
self.merge_or_build_meta(&meta_path, None, properties, attributes)?;
|
||||
let meta = self.merge_or_build_meta(&meta_path, None, properties, attributes)?;
|
||||
let content = crate::json::to_vec_pretty_sorted(&meta)
|
||||
.context("Failed to serialize meta.json5")?;
|
||||
self.suppress_path(&meta_path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue