From 91f405be3cd696e60016a17d33fd49a5365d4e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 13 Feb 2023 18:20:11 +0100 Subject: [PATCH] Remove try at --- czkawka_core/src/broken_files.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 1e5efde..08d8add 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -529,7 +529,15 @@ impl BrokenFiles { let mut file_entry_clone = file_entry.clone(); let result = panic::catch_unwind(|| { if let Err(e) = pdf::file::File::from_data_with_options(content, parser_options) { - file_entry.error_string = e.to_string(); + let mut error_string = e.to_string(); + // Workaround for strange error message https://github.com/qarmin/czkawka/issues/898 + if error_string.starts_with("Try at") { + if let Some(start_index) = error_string.find("/pdf-") { + error_string = format!("Decoding error in pdf-rs library - {}", &error_string[start_index..]); + } + } + + file_entry.error_string = error_string; let error = unpack_pdf_error(e); if let PdfError::InvalidPassword = error { return Some(None);