Fix extracting password protected archives

Closes: #1157

The fix splits the "canceled" and "failed" states for OperationError. It
also preserves that state because some functions overwrote the state by
rewrapping the error.
This commit is contained in:
Josh Megnauth 2025-09-01 01:28:26 -04:00 committed by Jeremy Soller
parent cf2e2faf3c
commit d8acbd2ce0
7 changed files with 341 additions and 189 deletions

View file

@ -81,7 +81,7 @@ use crate::{
mime_icon::{mime_for_path, mime_icon},
mounter::MOUNTERS,
mouse_area,
operation::Controller,
operation::{Controller, OperationError},
thumbnail_cacher::{CachedThumbnail, ThumbnailCacher, ThumbnailSize},
thumbnailer::thumbnailer,
};
@ -2469,10 +2469,13 @@ pub struct Tab {
window_id: Option<window::Id>,
}
async fn calculate_dir_size(path: &Path, controller: Controller) -> Result<u64, String> {
async fn calculate_dir_size(path: &Path, controller: Controller) -> Result<u64, OperationError> {
let mut total = 0;
for entry_res in WalkDir::new(path) {
controller.check().await?;
controller
.check()
.await
.map_err(|s| OperationError::from_state(s, &controller))?;
//TODO: report more errors?
if let Ok(entry) = entry_res {
@ -5717,7 +5720,7 @@ impl Tab {
);
Message::DirectorySize(
path.clone(),
DirSize::Error(err),
DirSize::Error(err.to_string()),
)
}
}