Fix quote inputs to skysh for whitespaced vals

If the matched group has a starting 0x22, only then remove the trailing
quotes. Similarly, if the matched group has a starting 0x27, only then
remove the trailing quote.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
next
Sayan Nandan 3 years ago
parent 90276e3ead
commit 0e645569b0
No known key found for this signature in database
GPG Key ID: 5EDED89A1ADA6273

@ -37,6 +37,7 @@ All changes in this project will be noted in this file.
### Fixes
- Fixed unexpected removal of single and double quotes from input strings in `skysh`
- Fixed incorrect removal of quotes from input strings in `skysh`
## Version 0.7.0

@ -70,11 +70,16 @@ pub fn split_into_args(q: &str) -> Vec<String> {
let mut chars = v.chars();
let first = chars.next();
let last = chars.last();
if let Some('"' | '\'') = first {
if let Some('"') = first {
v = &v[1..];
}
if let Some('"' | '\'') = last {
v = &v[..v.len()];
if let Some('"') = last {
v = &v[..v.len()];
}
} else if let Some('\'') = first {
v = &v[1..];
if let Some('\'') = last {
v = &v[..v.len()];
}
}
v.to_owned()
})

Loading…
Cancel
Save