mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 07:16:05 +02:00
Correct line folding in from ics
/from vcf
(#10577)
# Description Potential fix for #10398 datatracker.ietf.org/doc/html/rfc5545#section-3.1 datatracker.ietf.org/doc/html/rfc6350#section-3.2 --------- Co-authored-by: Joerg <joerg@schuetter.org>
This commit is contained in:
@ -14,9 +14,17 @@ pub fn from_ics_call(call: &EvaluatedCall, input: &Value) -> Result<Value, Label
|
||||
|
||||
let input_string = input_string
|
||||
.lines()
|
||||
.map(|x| x.trim().to_string())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
.enumerate()
|
||||
.map(|(i, x)| {
|
||||
if i == 0 {
|
||||
x.trim().to_string()
|
||||
} else if x.len() > 1 && (x.starts_with(' ') || x.starts_with('\t')) {
|
||||
x[1..].trim_end().to_string()
|
||||
} else {
|
||||
format!("\n{}", x.trim())
|
||||
}
|
||||
})
|
||||
.collect::<String>();
|
||||
|
||||
let input_bytes = input_string.as_bytes();
|
||||
let buf_reader = BufReader::new(input_bytes);
|
||||
|
@ -13,9 +13,17 @@ pub fn from_vcf_call(call: &EvaluatedCall, input: &Value) -> Result<Value, Label
|
||||
|
||||
let input_string = input_string
|
||||
.lines()
|
||||
.map(|x| x.trim().to_string())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
.enumerate()
|
||||
.map(|(i, x)| {
|
||||
if i == 0 {
|
||||
x.trim().to_string()
|
||||
} else if x.len() > 1 && (x.starts_with(' ') || x.starts_with('\t')) {
|
||||
x[1..].trim_end().to_string()
|
||||
} else {
|
||||
format!("\n{}", x.trim())
|
||||
}
|
||||
})
|
||||
.collect::<String>();
|
||||
|
||||
let input_bytes = input_string.as_bytes();
|
||||
let cursor = std::io::Cursor::new(input_bytes);
|
||||
|
Reference in New Issue
Block a user