Skip to content

Commit d9626d8

Browse files
procr1337hannesdejager
authored andcommitted
fix: MLSx facts must have a terminating semiolon according to RFC 3659 seciton 7.2
1 parent b5e1144 commit d9626d8

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

  • crates/unftp-sbe-fs/tests
  • src/server/controlchan/commands

crates/unftp-sbe-fs/tests/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,16 @@ mod mlsd {
713713
fn check_facts(line: &str, expected: &[&str]) {
714714
let parts: Vec<&str> = line.split(' ').collect();
715715
assert_eq!(parts.len(), 2, "Line should have facts and filename separated by space");
716+
717+
// RFC 3659 section 7.2 requires facts to end with a semicolon
718+
// Grammar: facts = 1*( fact ";" )
719+
// This means every fact must be followed by a semicolon, including the last one
720+
assert!(
721+
parts[0].ends_with(';'),
722+
"Facts string must end with a semicolon per RFC 3659 section 7.2, got: {}",
723+
parts[0]
724+
);
725+
716726
let facts = parts[0].split(';').collect::<Vec<_>>();
717727
for fact in expected {
718728
assert!(facts.contains(&fact), "Facts part should contain {}, got: {}", fact, parts[0]);

src/server/controlchan/commands/mlst.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ pub fn format_facts<M: Metadata>(metadata: &M) -> String {
9494
facts.push(format!("unix.gid={}", metadata.gid()));
9595
}
9696

97-
facts.join(";")
97+
format!("{};", facts.join(";"))
9898
}

0 commit comments

Comments
 (0)