mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2024-12-22 22:46:37 +00:00
fix: EXT-X-KEY: METHOD=NONE parsing error
This commit is contained in:
parent
381ac7732f
commit
59162b46d9
1 changed files with 14 additions and 1 deletions
|
@ -976,7 +976,7 @@ impl Key {
|
||||||
|
|
||||||
let uri = quoted_string!(attrs, "URI");
|
let uri = quoted_string!(attrs, "URI");
|
||||||
let iv = unquoted_string!(attrs, "IV");
|
let iv = unquoted_string!(attrs, "IV");
|
||||||
if method == KeyMethod::None && iv.is_none() {
|
if method != KeyMethod::None && iv.is_none() {
|
||||||
return Err("IV is required unless METHOD is NONE".parse().unwrap());
|
return Err("IV is required unless METHOD is NONE".parse().unwrap());
|
||||||
}
|
}
|
||||||
let keyformat = quoted_string!(attrs, "KEYFORMAT");
|
let keyformat = quoted_string!(attrs, "KEYFORMAT");
|
||||||
|
@ -1240,4 +1240,17 @@ mod test {
|
||||||
"#EXT-X-CUE-IN"
|
"#EXT-X-CUE-IN"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn key_none_method_parsing() {
|
||||||
|
let key = Key::from_hashmap(
|
||||||
|
vec![("METHOD".into(), QuotedOrUnquoted::Unquoted("NONE".into()))]
|
||||||
|
.into_iter()
|
||||||
|
.collect(),
|
||||||
|
);
|
||||||
|
|
||||||
|
assert!(key.is_ok());
|
||||||
|
let key = key.unwrap();
|
||||||
|
assert_eq!(key.method, KeyMethod::None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue