Browse Source

fix: stack overflow when '-laaR' are used

Erwin van Eijk 2 years ago
parent
commit
bce60ad620
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/output/color_scale.rs

+ 3 - 1
src/output/color_scale.rs

@@ -139,7 +139,9 @@ fn update_information_recursively(
             Extremes::update(size, &mut information.size);
         }
 
-        if file.is_directory() && r.is_some_and(|x| !x.is_too_deep(depth.0)) {
+        // We don't want to recurse into . and .., but still want to list them, therefore bypass
+        // the dot_filter.
+        if file.is_directory() && r.is_some_and(|x| !x.is_too_deep(depth.0)) && file.name != "." && file.name != ".." {
             match file.to_dir() {
                 Ok(dir) => {
                     let files: Vec<File<'_>> = dir