mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2024-11-15 21:21:08 +00:00
Parse #EXT-X-MAP BYTERANGE attr from quoted string
This commit is contained in:
parent
e7a6cf943c
commit
ae31a2741f
1 changed files with 9 additions and 6 deletions
|
@ -555,13 +555,16 @@ fn extmap(i: &[u8]) -> IResult<&[u8], Map> {
|
|||
}
|
||||
None => Err("URI is empty"),
|
||||
}?;
|
||||
let byte_range = attrs
|
||||
.remove("BYTERANGE")
|
||||
.map(|range| match byte_range_val(range.to_string().as_bytes()) {
|
||||
IResult::Ok((_, range)) => Ok(range),
|
||||
let byte_range = match attrs.remove("BYTERANGE") {
|
||||
Some(QuotedOrUnquoted::Quoted(s)) => match byte_range_val(s.as_bytes()) {
|
||||
IResult::Ok((_, range)) => Ok(Some(range)),
|
||||
IResult::Err(_) => Err("Invalid byte range"),
|
||||
})
|
||||
.transpose()?;
|
||||
},
|
||||
Some(QuotedOrUnquoted::Unquoted(_)) => {
|
||||
Err("Can't create BYTERANGE attribute from unquoted string")
|
||||
}
|
||||
None => Ok(None),
|
||||
}?;
|
||||
|
||||
Ok(Map {
|
||||
uri,
|
||||
|
|
Loading…
Reference in a new issue