Skip to content

Commit

Permalink
⬆️ Upgrade unrar dependency (#235)
Browse files Browse the repository at this point in the history
Moving off of custom fork now that the required functionality is in main 🙌
  • Loading branch information
aaronleopold committed Jan 14, 2024
1 parent e7fabac commit 1b567ea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
11 changes: 6 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ image = "0.24.7"
webp = "0.2.6"
zip = "0.6.6"
epub = "1.2.4"
unrar = { git = "https://github.com/stumpapp/unrar.rs", branch = "feature/typestate" }
# unrar = { version = "0.5.1" }
# unrar = { git = "https://github.com/stumpapp/unrar.rs", branch = "feature/typestate" }
unrar = { version = "0.5.2" }
# pdf = "0.8.1"
pdf = { git = "https://github.com/pdf-rs/pdf", rev = "3bc9e636d31b1846e51b58c7429914e640866f53" } # TODO: revert back to crates.io once fix(es) release
pdfium-render = "0.8.16"
Expand Down
12 changes: 4 additions & 8 deletions core/src/filesystem/media/rar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ impl FileProcessor for RarProcessor {
let mut pages = 0;
let mut metadata_buf = None;

while let Some(header) = archive.read_header() {
let header = header?;
while let Ok(Some(header)) = archive.read_header() {
let entry = header.entry();
if entry.filename.as_os_str() == "ComicInfo.xml" {
let (data, rest) = header.read()?;
Expand Down Expand Up @@ -153,8 +152,7 @@ impl FileProcessor for RarProcessor {

let mut bytes = None;
let mut archive = Archive::new(file).open_for_processing()?;
while let Some(header) = archive.read_header() {
let header = header?;
while let Ok(Some(header)) = archive.read_header() {
let is_target =
header.entry().filename.as_os_str() == target_entry.filename.as_os_str();
if is_target {
Expand Down Expand Up @@ -197,8 +195,7 @@ impl FileProcessor for RarProcessor {

let mut content_types = HashMap::new();
let mut archive = Archive::new(path).open_for_processing()?;
while let Some(header) = archive.read_header() {
let header = header?;
while let Ok(Some(header)) = archive.read_header() {
archive = if let Some(tuple) =
entries.get_key_value(&PathBuf::from(header.entry().filename.as_os_str()))
{
Expand Down Expand Up @@ -252,8 +249,7 @@ impl FileConverter for RarProcessor {
trace!(?unpacked_path, "Extracting RAR to cache");

let mut archive = Archive::new(path).open_for_processing()?;
while let Some(header) = archive.read_header() {
let header = header?;
while let Ok(Some(header)) = archive.read_header() {
archive = if header.entry().is_file() {
header.extract_to(&unpacked_path)?
} else {
Expand Down

0 comments on commit 1b567ea

Please sign in to comment.