1
0
mirror of https://github.com/nushell/nushell.git synced 2025-07-13 12:56:22 +02:00

fix plugin path with whitespace ()

This commit is contained in:
WindSoilder
2022-06-25 01:44:22 +08:00
committed by GitHub
parent 533e04a60a
commit f02076daa8

@ -362,9 +362,18 @@ impl EngineState {
// No need to check the None option // No need to check the None option
let (path, encoding, shell) = let (path, encoding, shell) =
decl.is_plugin().expect("plugin should have file name"); decl.is_plugin().expect("plugin should have file name");
let file_name = path let mut file_name = path
.to_str() .to_str()
.expect("path was checked during registration as a str"); .expect("path was checked during registration as a str")
.to_string();
// Fix files or folders with quotes
if file_name.contains('\'')
|| file_name.contains('"')
|| file_name.contains(' ')
{
file_name = format!("`{}`", file_name);
}
serde_json::to_string_pretty(&decl.signature()) serde_json::to_string_pretty(&decl.signature())
.map(|signature| { .map(|signature| {