diff --git a/src/shell/filesystem_shell.rs b/src/shell/filesystem_shell.rs index 2ba27e764f..0c686f97d8 100644 --- a/src/shell/filesystem_shell.rs +++ b/src/shell/filesystem_shell.rs @@ -115,7 +115,11 @@ impl Shell for FilesystemShell { for entry in entries { let entry = entry?; let filepath = entry.path(); - let filename = filepath.strip_prefix(&cwd).unwrap(); + let filename = if let Ok(fname) = filepath.strip_prefix(&cwd) { + fname + } else { + Path::new(&filepath) + }; let value = dir_entry_dict( filename, &entry.metadata()?,