diff --git a/crates/core/plugin_sm/src/plugin.rs b/crates/core/plugin_sm/src/plugin.rs index 851903c8432..ed3e1fc989d 100644 --- a/crates/core/plugin_sm/src/plugin.rs +++ b/crates/core/plugin_sm/src/plugin.rs @@ -554,5 +554,17 @@ fn sm_path(name: &str, version: &Option, target_dir_path: impl AsRef String { + let mut result = String::new(); + filename.chars().for_each(|c| { + if matches!(c as u8, b'0'..=b'9' | b'A'..=b'Z' | b'a'..=b'z' | b'-' | b'.' | b'_' | b'~') { + result.push(c) + } else { + result.push_str(&format!("%{:x?}", c as u8)) + } + }); + result }