get_rootfile() simplified
This commit is contained in:
parent
8b38cee7b8
commit
da77983228
2 changed files with 11 additions and 12 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -396,7 +396,7 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
|||
|
||||
[[package]]
|
||||
name = "pbdbfixer"
|
||||
version = "0.8.3"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"quick-xml",
|
||||
"rusqlite",
|
||||
|
|
21
src/epub.rs
21
src/epub.rs
|
@ -61,18 +61,17 @@ fn get_rootfile(archive: &mut ZipArchive<File>) -> String {
|
|||
loop {
|
||||
match reader.read_event_into(&mut buf) {
|
||||
Ok(Event::Start(ref e)) | Ok(Event::Empty(ref e))
|
||||
if e.local_name().into_inner() == b"rootfile" =>
|
||||
if e.name().as_ref() == b"rootfile" =>
|
||||
{
|
||||
opf_filename = String::from_utf8(
|
||||
e.attributes()
|
||||
.filter(|attr| attr.as_ref().unwrap().key.into_inner() == b"full-path")
|
||||
.next()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.value
|
||||
.to_vec(),
|
||||
)
|
||||
.unwrap();
|
||||
opf_filename = e
|
||||
.attributes()
|
||||
.filter(|attr| attr.as_ref().unwrap().key.as_ref() == b"full-path")
|
||||
.next()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.unescape_value()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
break;
|
||||
}
|
||||
Ok(Event::Eof) => break,
|
||||
|
|
Loading…
Reference in a new issue