mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2025-01-06 12:58:41 +00:00
fix: incorrect duration_title parsing.
This commit is contained in:
parent
381ac7732f
commit
ff3ffba3bf
1 changed files with 18 additions and 3 deletions
|
@ -526,11 +526,10 @@ fn duration_title_tag(i: &[u8]) -> IResult<&[u8], (f32, Option<String>)> {
|
|||
tuple((
|
||||
float,
|
||||
opt(char(',')),
|
||||
opt(map_res(is_not("\r\n,"), from_utf8_slice)),
|
||||
opt(map_res(is_not("\r\n"), from_utf8_slice)),
|
||||
take(1usize),
|
||||
opt(char(',')),
|
||||
)),
|
||||
|(duration, _, title, _, _)| (duration, title),
|
||||
|(duration, _, title, _)| (duration, title),
|
||||
)(i)
|
||||
}
|
||||
|
||||
|
@ -995,6 +994,22 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_duration_title_with_commas() {
|
||||
assert_eq!(
|
||||
duration_title_tag(b"2.002,title,with,commas\nrest"),
|
||||
Result::Ok(("rest".as_bytes(), (2.002f32, Some("title,with,commas".to_string()))))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_duration_title_without_title() {
|
||||
assert_eq!(
|
||||
duration_title_tag(b"2.002\nrest"),
|
||||
Result::Ok(("rest".as_bytes(), (2.002f32, None)))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn incomplete_manifest() {
|
||||
assert!(!is_master_playlist(
|
||||
|
|
Loading…
Reference in a new issue