Skip to content

Commit bf9dd35

Browse files
authored
Small fixes (#786)
1 parent d5b0878 commit bf9dd35

21 files changed

+391
-52
lines changed

.github/workflows/mac.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
toolchain: [ stable ]
1616
type: [ release ]
17-
runs-on: macos-10.15
17+
runs-on: macos-latest
1818
steps:
1919
- uses: actions/checkout@v2
2020

@@ -50,7 +50,7 @@ jobs:
5050
matrix:
5151
toolchain: [ stable ]
5252
type: [ release ]
53-
runs-on: macos-10.15
53+
runs-on: macos-latest
5454
steps:
5555
- uses: actions/checkout@v2
5656

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Changelog.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
- Fix disabled ui when using invalid settings in similar music - [#740](https://github.com/qarmin/czkawka/pull/740)
1414
- Speedup searching for invalid extensions - [#740](https://github.com/qarmin/czkawka/pull/740)
1515
- Support for finding the smallest files - [#741](https://github.com/qarmin/czkawka/pull/741)
16-
- Improve Windows CI - [#749](https://github.com/qarmin/czkawka/pull/749)
16+
- Improved Windows CI - [#749](https://github.com/qarmin/czkawka/pull/749)
1717
- Ability to check for broken files by types - [#749](https://github.com/qarmin/czkawka/pull/749)
1818
- Add heif and Webp files support - [#750](https://github.com/qarmin/czkawka/pull/750)
1919
- Use in CLI Clap library instead StructOpt - [#759](https://github.com/qarmin/czkawka/pull/759)
20+
- Multiple directories can be added via Manual Add button - [#782](https://github.com/qarmin/czkawka/pull/782)
21+
- Option to exclude files from other filesystems in GUI(Linux) - [#776](https://github.com/qarmin/czkawka/pull/776)
2022

2123
## Version 4.1.0 - 24.04.2022r
2224
- New mode - finding files whose content not match with their extension - [#678](https://github.com/qarmin/czkawka/pull/678)

czkawka_core/src/broken_files.rs

+25-23
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use pdf::PdfError::Try;
1515
use rayon::prelude::*;
1616
use serde::{Deserialize, Serialize};
1717

18-
use crate::common::{open_cache_folder, Common, LOOP_DURATION, PDF_FILES_EXTENSIONS};
18+
use crate::common::{create_crash_message, open_cache_folder, Common, LOOP_DURATION, PDF_FILES_EXTENSIONS};
1919
use crate::common::{AUDIO_FILES_EXTENSIONS, IMAGE_RS_BROKEN_FILES_EXTENSIONS, ZIP_FILES_EXTENSIONS};
2020
use crate::common_directory::Directories;
2121
use crate::common_extensions::Extensions;
@@ -477,8 +477,9 @@ impl BrokenFiles {
477477
if let Ok(image_result) = result {
478478
image_result
479479
} else {
480-
println!("Image-rs library crashed when opening \"{:?}\" image, please check if problem happens with latest image-rs version(this can be checked via https://github.com/qarmin/ImageOpening tool) and if it is not reported, please report bug here - https://github.com/image-rs/image/issues", file_entry_clone.path);
481-
file_entry_clone.error_string = "Image crashes due parsing, please check if problem happens with updated https://github.com/qarmin/ImageOpening and later report here https://github.com/image-rs/image/issues".to_string();
480+
let message = create_crash_message("Image-rs", &file_entry_clone.path.to_string_lossy().to_string(), "https://github.com/Serial-ATA/lofty-rs");
481+
println!("{message}");
482+
file_entry_clone.error_string = message;
482483
Some(Some(file_entry_clone))
483484
}
484485
}
@@ -489,28 +490,28 @@ impl BrokenFiles {
489490
}
490491
Some(Some(file_entry))
491492
}
492-
Err(_inspected) => Some(None)
493+
Err(_inspected) => Some(None),
493494
},
494495
TypeOfFile::Audio => match File::open(&file_entry.path) {
495-
Ok(file) =>
496-
{
497-
let mut file_entry_clone = file_entry.clone();
498-
499-
let result = panic::catch_unwind(|| {
500-
if let Err(e) = audio_checker::parse_audio_file(file) {
501-
file_entry.error_string = e.to_string();
502-
}
503-
Some(Some(file_entry))
504-
});
496+
Ok(file) => {
497+
let mut file_entry_clone = file_entry.clone();
505498

506-
if let Ok(audio_result) = result {
507-
audio_result
508-
} else {
509-
println!("External parsing audio library crashed when opening \"{:?}\" audio file, please report bug here - https://github.com/qarmin/audio_checker/issues", file_entry_clone.path);
510-
file_entry_clone.error_string = "Audio crashes due parsing, please report bug here - https://github.com/qarmin/audio_checker/issues".to_string();
511-
Some(Some(file_entry_clone))
499+
let result = panic::catch_unwind(|| {
500+
if let Err(e) = audio_checker::parse_audio_file(file) {
501+
file_entry.error_string = e.to_string();
512502
}
503+
Some(Some(file_entry))
504+
});
505+
506+
if let Ok(audio_result) = result {
507+
audio_result
508+
} else {
509+
let message = create_crash_message("Symphonia", &file_entry_clone.path.to_string_lossy().to_string(), "https://github.com/pdeljanov/Symphonia");
510+
println!("{message}");
511+
file_entry_clone.error_string = message;
512+
Some(Some(file_entry_clone))
513513
}
514+
}
514515
Err(_inspected) => Some(None),
515516
},
516517

@@ -540,12 +541,13 @@ impl BrokenFiles {
540541
if let Ok(pdf_result) = result {
541542
pdf_result
542543
} else {
543-
println!("PDF-rs library crashed when opening \"{:?}\" pdf, and if it is not reported, please report bug here - https://github.com/pdf-rs/pdf", file_entry_clone.path);
544-
file_entry_clone.error_string = "PDF-rs library crashed when opening pdf, and if it is not reported, please report bug here - https://github.com/pdf-rs/pdf".to_string();
544+
let message = create_crash_message("PDF-rs", &file_entry_clone.path.to_string_lossy().to_string(), "https://github.com/pdf-rs/pdf");
545+
println!("{message}");
546+
file_entry_clone.error_string = message;
545547
Some(Some(file_entry_clone))
546548
}
547549
}
548-
Err(_inspected) => Some(None)
550+
Err(_inspected) => Some(None),
549551
}
550552
}
551553

czkawka_core/src/common.rs

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ pub fn split_path(path: &Path) -> (String, String) {
167167
}
168168
}
169169

170+
pub fn create_crash_message(library_name: &str, file_path: &str, home_library_url: &str) -> String {
171+
format!("{library_name} library crashed when opening \"{file_path}\", please check if this is fixed with the latest version of {library_name} (e.g. with https://github.com/qarmin/crates_tester) and if it is not fixed, please report bug here - {home_library_url}")
172+
}
173+
170174
impl Common {
171175
/// Printing time which took between start and stop point and prints also function name
172176
#[allow(unused_variables)]

czkawka_core/src/same_music.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use lofty::{read_from, AudioFile, ItemKey};
1414
use rayon::prelude::*;
1515
use serde::{Deserialize, Serialize};
1616

17-
use crate::common::AUDIO_FILES_EXTENSIONS;
17+
use crate::common::{create_crash_message, AUDIO_FILES_EXTENSIONS};
1818
use crate::common::{open_cache_folder, Common, LOOP_DURATION};
1919
use crate::common_dir_traversal::{CheckingMethod, DirTraversalBuilder, DirTraversalResult, FileEntry, ProgressData};
2020
use crate::common_directory::Directories;
@@ -393,7 +393,8 @@ impl SameMusic {
393393
}
394394
},
395395
Err(_) => {
396-
println!("File {} crashed during reading tags, please report bug", path);
396+
let message = create_crash_message("Lofty", &path, "https://github.com/image-rs/image/issues");
397+
println!("{message}");
397398
return Some(None);
398399
}
399400
};

czkawka_core/src/similar_images.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ use serde::{Deserialize, Serialize};
2020

2121
#[cfg(feature = "heif")]
2222
use crate::common::get_dynamic_image_from_heic;
23-
use crate::common::{get_dynamic_image_from_raw_image, open_cache_folder, Common, HEIC_EXTENSIONS, IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS, LOOP_DURATION, RAW_IMAGE_EXTENSIONS};
23+
use crate::common::{
24+
create_crash_message, get_dynamic_image_from_raw_image, open_cache_folder, Common, HEIC_EXTENSIONS, IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS, LOOP_DURATION, RAW_IMAGE_EXTENSIONS,
25+
};
2426
use crate::common_directory::Directories;
2527
use crate::common_extensions::Extensions;
2628
use crate::common_items::ExcludedItems;
@@ -563,8 +565,7 @@ impl SimilarImages {
563565
if RAW_IMAGE_EXTENSIONS.iter().any(|e| file_name_lowercase.ends_with(e)) {
564566
image = match get_dynamic_image_from_raw_image(&file_entry.path) {
565567
Some(t) => t,
566-
None =>
567-
return Some(Some((file_entry, Vec::new())))
568+
None => return Some(Some((file_entry, Vec::new()))),
568569
};
569570
break 'krztyna;
570571
}
@@ -599,7 +600,8 @@ impl SimilarImages {
599600
return Some(Some((file_entry, Vec::new())));
600601
}
601602
} else {
602-
println!("Image-rs library crashed when opening \"{:?}\" image, please check if problem happens with latest image-rs version(this can be checked via https://github.com/qarmin/ImageOpening tool) and if it is not reported, please report bug here - https://github.com/image-rs/image/issues", file_entry.path);
603+
let message = create_crash_message("Image-rs", &file_entry.path.to_string_lossy().to_string(), "https://github.com/image-rs/image/issues");
604+
println!("{message}");
603605
return Some(Some((file_entry, Vec::new())));
604606
}
605607

czkawka_gui/icons/czk_hide_down.svg

+105-1
Loading

0 commit comments

Comments
 (0)