Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/utils/dif_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,16 +447,30 @@ where
P: AsRef<Path>,
F: FnMut(DifSource, String, ByteView<'static>) -> Result<(), Error>,
{
let directory = directory.as_ref();
debug!("searching location {}", directory.display());
for entry in WalkDir::new(&directory).into_iter().filter_map(|e| e.ok()) {
if !entry.metadata()?.is_file() {
// Walkdir recurses automatically into folders
continue;
}

let path = entry.path();
if let Some(zip) = try_open_zip(path)? {
walk_difs_zip(zip, options, &mut func)?;
continue;
match try_open_zip(path) {
Ok(Some(zip)) => {
debug!("searching zip archive {}", path.display());
walk_difs_zip(zip, options, &mut func)?;
debug!("finished zip archive {}", path.display());
continue;
}
Err(e) => {
debug!("skipping zip archive {}", path.display());
debug!("error: {}", e);
continue;
}
Ok(None) => {
// this is not a zip archive
}
}

if !options.valid_extension(path.extension()) {
Expand All @@ -472,6 +486,7 @@ where
func(DifSource::FileSystem(path), name, buffer)?;
}

debug!("finished location {}", directory.display());
Ok(())
}

Expand Down Expand Up @@ -539,7 +554,7 @@ fn search_difs(options: &DifUpload) -> Result<Vec<DifMatch<'static>>, Error> {
return Ok(());
}

debug!("trying to parse dif {}", &name);
debug!("trying to parse dif {}", name);
let fat = match FatObject::parse(buffer) {
Ok(fat) => Rc::new(fat),
Err(e) => {
Expand Down