Skip to content

Commit

Permalink
posix: Minor cleanup / typo correction
Browse files Browse the repository at this point in the history
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
  • Loading branch information
rye committed Oct 15, 2023
1 parent 9088ac4 commit 594bcaa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions suppaftp/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl File {
match POSIX_LS_RE.captures(line) {
// String matches regex
Some(metadata) => {
trace!("Parsed POXIS line {}", line);
trace!("Parsed POSIX line {}", line);
// NOTE: metadata fmt: (regex, file_type, permissions, link_count, uid, gid, filesize, mtime, filename)
// Expected 7 + 1 (8) values: + 1 cause regex is repeated at 0
if metadata.len() < 8 {
Expand Down Expand Up @@ -414,10 +414,11 @@ impl TryFrom<&str> for File {
type Error = ParseError;

fn try_from(line: &str) -> Result<Self, Self::Error> {
// First try to parse the line in POSIX format (vast majority case).
match Self::from_posix_line(line) {
Ok(entry) => Ok(entry),
// If POSIX parsing fails, try with DOS parser.
Err(_) => match Self::from_dos_line(line) {
// If POSIX parsing fails, try with DOS parser
Ok(entry) => Ok(entry),
Err(err) => Err(err),
},
Expand Down

0 comments on commit 594bcaa

Please sign in to comment.