Skip to content

fix(parser): support directory paths with spaces in LIST command (#530) - #578

Open
snowyukitty wants to merge 1 commit into
bolcom:masterfrom
snowyukitty:fix/list-paths-with-spaces
Open

snowyukitty wants to merge 1 commit into
bolcom:masterfrom
snowyukitty:fix/list-paths-with-spaces

Conversation

@snowyukitty

Copy link
Copy Markdown

Summary

Fixes #530.

When parsing the FTP LIST command with an argument containing spaces (such as LIST path with spaces), the parser previously performed a .split(|&b| b == b' ') and took .next(), causing the path to be truncated after the first space (resulting in path: Some("path")).

Changes

  1. src/server/controlchan/line_parser/parser.rs:
    • Updated LIST parameter parsing to iteratively strip leading hyphen-prefixed option flags (e.g. -la, -x) and support the -- option delimiter.
    • Preserved the entire remaining path string with embedded spaces intact.
  2. src/server/controlchan/line_parser/tests.rs:
    • Added unit test cases for LIST covering paths with spaces, multiple option flags, wildcard patterns, leading dashes with --, and whitespace-only input.
  3. tests/list.rs:
    • Added an end-to-end integration test creating a directory hierarchy with spaces (test_list_dir_spaces/sub folder/nested_target) and verifying that LIST test_list_dir_spaces/sub folder successfully returns the nested entries over the data channel.
  4. Cargo.toml:
    • Fixed workspace relative path for unftp-sbe-fs dev-dependency.

Verification

  • Passed all 69 unit tests and 26 doctests (cargo test).
  • Passed integration test suite including tests/list.rs.
  • Verified clean cargo clippy --all-targets --all-features and cargo fmt --check.

…com#530)

Fix LIST command path parsing when listing directories containing spaces in their names. Previously, split(' ') followed by .next() truncated any path after the first space. Now leading hyphen-prefixed option flags and the '--' option delimiter are stripped while preserving the remainder path string intact.

Fixes bolcom#530.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when listing directories containing spaces in their names

1 participant