Skip to content

Commit 094ea00

Browse files
authored
Simplify path length check in download_and_unpack_nested_gzip_archive (#540)
Avoids constructing the `PathBuf` components iterator and then fully iterating it just to determine whether it's empty.
1 parent 625e5e5 commit 094ea00

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pub(crate) fn download_and_unpack_nested_gzip_archive(
124124
.collect::<PathBuf>();
125125

126126
// The path will be empty here if there were files shallower than the strip_components depth.
127-
if stripped_path.components().count() > 0 {
127+
if !stripped_path.as_os_str().is_empty() {
128128
entry
129129
.unpack(destination.join(stripped_path))
130130
.map_err(DownloadUnpackArchiveError::Unpack)?;

0 commit comments

Comments
 (0)