diff --git a/CHANGELOG.md b/CHANGELOG.md index f663987..7553950 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ Categories Used: - Fix decompression of zip archives with files larger than 4GB [\#354](https://github.com/ouch-org/ouch/pull/354) ([figsoda](https://github.com/figsoda)) +- Fix handling of unknown extensions during decompression [\#355](https://github.com/ouch-org/ouch/pull/355) ([figsoda](https://github.com/figsoda)) + ## [0.4.1](https://github.com/ouch-org/ouch/compare/0.4.0...0.4.1) ### New Features @@ -103,7 +105,7 @@ Categories Used: - Optimize `strip_cur_dir` [\#167](https://github.com/ouch-org/ouch/pull/167) ([vrmiguel](https://github.com/vrmiguel)) - Improve zip errors when paths are not utf8 valid [\#181](https://github.com/ouch-org/ouch/pull/181) ([marcospb19](https://github.com/marcospb19)) - Simplify/optimize several file inferring functions [\#204](https://github.com/ouch-org/ouch/pull/204) ([vrmiguel](https://github.com/vrmiguel)) -- List command: print file immediatly after it is processed [\#225](https://github.com/ouch-org/ouch/pull/225) ([sigmaSd](https://github.com/sigmaSd)) +- List command: print file immediately after it is processed [\#225](https://github.com/ouch-org/ouch/pull/225) ([sigmaSd](https://github.com/sigmaSd)) - Use `Cow<'static, str>` in `FinalError` [\#246](https://github.com/ouch-org/ouch/pull/246) ([vrmiguel](https://github.com/vrmiguel)) - Don't allocate when possible in `to_utf`, `nice_directory_display` [\#249](https://github.com/ouch-org/ouch/pull/249) ([vrmiguel](https://github.com/vrmiguel)) - Allow overriding the completions output directory [\#251]](https://github.com/ouch-org/ouch/pull/251) ([jcgruenhage](https://github.com/jcgruenhage)) @@ -178,14 +180,14 @@ Categories Used: - Empty folders are ignored in archive compression formats [\#41](https://github.com/ouch-org/ouch/issues/41) ([GabrielSimonetto](https://github.com/GabrielSimonetto)) - fix macOS executable paths [\#69](https://github.com/ouch-org/ouch/pull/69) ([vrmiguel](https://github.com/vrmiguel)) -- Print the format type when the format is in an incorrent position [\#84](https://github.com/ouch-org/ouch/pull/84) ([dcariotti](https://github.com/dcariotti)) +- Print the format type when the format is in an incorrect position [\#84](https://github.com/ouch-org/ouch/pull/84) ([dcariotti](https://github.com/dcariotti)) - Compressing a single file to a single format that's not `tar` or `zip` panics [\#87](https://github.com/ouch-org/ouch/issues/87) & [\#89](https://github.com/ouch-org/ouch/pull/89) ([marcospb19](https://github.com/marcospb19)) - Compression flag `--output` not working with single file compression [\#90](https://github.com/ouch-org/ouch/issues/90) & [\#93](https://github.com/ouch-org/ouch/pull/93) ([figsoda](https://github.com/figsoda)) - Fix NO_COLOR issues, remove some dead code [\#66](https://github.com/ouch-org/ouch/issues/66), [\#62](https://github.com/ouch-org/ouch/issues/62), & [\#95](https://github.com/ouch-org/ouch/pull/95) ([figsoda](https://github.com/figsoda)) - Add proper error message when using conflicting flags \(e.g. `--yes --no`\) [\#55](https://github.com/ouch-org/ouch/issues/55) & [\#99](https://github.com/ouch-org/ouch/pull/99) ([SpyrosRoum](https://github.com/SpyrosRoum)) - Fix wrong archive format detection patterns [\#125](https://github.com/ouch-org/ouch/pull/125) ([SpyrosRoum](https://github.com/SpyrosRoum)) - Decompressing file without extension gives bad error message [\#137](https://github.com/ouch-org/ouch/issues/137) ([marcospb19](https://github.com/marcospb19)) -- Fix decompression overwritting files without asking and failing on directories [\#141](https://github.com/ouch-org/ouch/pull/141) ([SpyrosRoum](https://github.com/SpyrosRoum)) +- Fix decompression overwriting files without asking and failing on directories [\#141](https://github.com/ouch-org/ouch/pull/141) ([SpyrosRoum](https://github.com/SpyrosRoum)) ### Improvements diff --git a/Cargo.lock b/Cargo.lock index a408cb7..4394a57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -714,7 +714,6 @@ dependencies = [ "xz2", "zip", "zstd", - "zstd-sys", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6723e19..22b92c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,9 +33,6 @@ ubyte = { version = "0.10.3", default-features = false } xz2 = "0.1.7" zip = { version = "0.6.3", default-features = false, features = ["time"] } zstd = { version = "0.12.2", default-features = false } -# zstd-sys > 2.0.1 unconditionally enables thin LTO and causes CI to fail -# https://github.com/gyscos/zstd-rs/pull/155 -zstd-sys = "=2.0.1" [target.'cfg(unix)'.dependencies] time = { version = "0.3.17", default-features = false } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index e2c6954..95f8cfc 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -366,7 +366,7 @@ fn check_mime_type( // File with no extension // Try to detect it automatically and prompt the user about it if let Some(detected_format) = try_infer_extension(path) { - // Infering the file extension can have unpredicted consequences (e.g. the user just + // Inferring the file extension can have unpredicted consequences (e.g. the user just // mistyped, ...) which we should always inform the user about. info!( accessible, diff --git a/src/error.rs b/src/error.rs index 8771e68..138fef8 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,6 @@ //! Error types definitions. //! -//! All usage errors will pass throught the Error enum, a lot of them in the Error::Custom. +//! All usage errors will pass through the Error enum, a lot of them in the Error::Custom. use std::{ borrow::Cow, @@ -73,7 +73,7 @@ impl Display for FinalError { if !self.hints.is_empty() { // Separate by one blank line. writeln!(f)?; - // to reduce redundant output for text-to-speach systems, braille + // to reduce redundant output for text-to-speech systems, braille // displays and so on, only print "hints" once in ACCESSIBLE mode if is_running_in_accessible_mode() { write!(f, "\n{}hints:{}", *GREEN, *RESET)?; diff --git a/src/extension.rs b/src/extension.rs index a4166af..46b27dd 100644 --- a/src/extension.rs +++ b/src/extension.rs @@ -113,11 +113,12 @@ fn to_extension(ext: &[u8]) -> Option { )) } -fn split_extension<'a>(name: &mut &'a [u8]) -> Option<&'a [u8]> { +fn split_extension(name: &mut &[u8]) -> Option { let (new_name, ext) = name.rsplit_once_str(b".")?; if matches!(new_name, b"" | b"." | b"..") { return None; } + let ext = to_extension(ext)?; *name = new_name; Some(ext) } @@ -149,7 +150,7 @@ pub fn separate_known_extensions_from_name(path: &Path) -> (&Path, Vec, y: impl Into, prese (x, y) => { panic!( - "directories don't have the same number of entires\n left: `{:?}`,\n right: `{:?}`", + "directories don't have the same number of entries\n left: `{:?}`,\n right: `{:?}`", x.map(|x| x.path()), y.map(|y| y.path()), )