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:
joergsch
2023-10-03 19:11:16 +02:00
committed by GitHub
parent f481879ed3
commit e8da57b05e
4 changed files with 107 additions and 8 deletions

View File

@ -1,4 +1,4 @@
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
@ -98,3 +98,47 @@ fn from_ics_text_to_table() {
assert_eq!(actual.out, "Maryland Game");
})
}
#[test]
fn from_ics_text_with_linebreak_to_table() {
Playground::setup("filter_from_ics_test_3", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContent(
"calendar.txt",
r#"BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20171007T200000Z
DTEND:20171007T233000Z
DTSTAMP:20200319T182138Z
UID:4l80f6dcovnriq38g57g07btid@google.com
CREATED:20170719T202915Z
DESCRIPTION:
LAST-MODIFIED:20170930T190808Z
LOCATION:The Restaurant n
ear the
Belltower
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:Dinner
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR"#,
)]);
let cwd = dirs.test();
let actual = nu_with_plugins!(
cwd: cwd,
plugin: ("nu_plugin_formats"),
r#"
open calendar.txt
| from ics
| get events.0
| get properties.0
| where name == "LOCATION"
| first
| get value
"#
);
assert_eq!(actual.out, "The Restaurant near the Belltower");
})
}