summaryrefslogtreecommitdiff
path: root/crates/utils/string_proc/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-12-15 10:05:37 +0800
committer魏曹先生 <1992414357@qq.com>2025-12-15 10:05:37 +0800
commitad60d1f5e46e0fbe2a5463a511c4fccc9b5198b5 (patch)
tree1929fd1eb6a14a57b5875478e9eacea644e767d2 /crates/utils/string_proc/src
parenta2906e73faa8ed45976d83e8ec88c3e6e34c24c8 (diff)
Add edit mapping action for sheet operations
Diffstat (limited to 'crates/utils/string_proc/src')
-rw-r--r--crates/utils/string_proc/src/format_path.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/utils/string_proc/src/format_path.rs b/crates/utils/string_proc/src/format_path.rs
index 152b791..35689b8 100644
--- a/crates/utils/string_proc/src/format_path.rs
+++ b/crates/utils/string_proc/src/format_path.rs
@@ -38,6 +38,11 @@ pub fn format_path_str(path: impl Into<String>) -> Result<String, std::io::Error
result.push('/');
}
+ // Special case: when result is only "./", return ""
+ if result == "./" {
+ return Ok(String::new());
+ }
+
Ok(result)
}
@@ -97,6 +102,10 @@ mod tests {
"/home/my_user/DOCS/JVCS_TEST/Vault/"
);
+ assert_eq!(format_path_str("./home/file.txt")?, "home/file.txt");
+ assert_eq!(format_path_str("./home/path/")?, "home/path/");
+ assert_eq!(format_path_str("./")?, "");
+
Ok(())
}
}