mirror of
https://github.com/nushell/nushell
synced 2024-12-29 14:33:13 +00:00
fix plugin path with whitespace (#5871)
This commit is contained in:
parent
533e04a60a
commit
f02076daa8
1 changed files with 11 additions and 2 deletions
|
@ -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| {
|
||||||
|
|
Loading…
Reference in a new issue