Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: MKD in unftp_sbe_opendal is broken due '/' requirement in path end #5380

Closed
1 task
vdudouyt opened this issue Dec 2, 2024 · 3 comments · Fixed by #5382
Closed
1 task

bug: MKD in unftp_sbe_opendal is broken due '/' requirement in path end #5380

vdudouyt opened this issue Dec 2, 2024 · 3 comments · Fixed by #5382
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@vdudouyt
Copy link

vdudouyt commented Dec 2, 2024

Describe the bug

I'm trying to run a simple hello world program with unftp_sbe_opendal v0.0.6 and OpenDAL v0.52.0. Somehow I end up with MKD command not working due a convention to add "/" in the end of directory path, which unftp_sbe_opendal is apparently breaking.

#[tokio::main]
async fn main() -> Result<()> {
    let builder = opendal::services::Memory::default()
        .root("/");
    let op = Operator::new(builder)?.finish();
    let backend = OpendalStorage::new(op);
    let server = libunftp::ServerBuilder::new(Box::new(move || backend.clone()))
        .greeting("Welcome to my FTP server")
        .active_passive_mode(ActivePassiveMode::PassiveOnly)
        .passive_ports(50000..65535)
        .build().unwrap();

    let _ = server.listen("0.0.0.0:21").await;
    Ok(())
}

In my Filezilla log I have:

Status:	Creating directory '/Test'...
Command:	MKD Test
Response:	451 Local error

In my env_logger I have:

MKD: Failure creating directory "/Test" storage error: 451 Local error, source: myip:2311, trace-id: 0xd9067fe760e85899
Control channel event InternalMsg(StorageError(Error { kind: LocalError, source: Some(NotADirectory (permanent) at create_dir => the path trying to create should end with `/`

Steps to Reproduce

  1. Run any application using unftp_sbe_opendal and OpenDAL v0.52.0. You can use main.rs from example above
  2. Connect with FTP client (personally, I'm using Filezilla)
  3. Try to create a directory

Expected Behavior

I expect the directory to be created

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.
@vdudouyt vdudouyt added the bug Something isn't working label Dec 2, 2024
@Xuanwo
Copy link
Member

Xuanwo commented Dec 2, 2024

Thank you, @vdudouyt, for the report.

This should be straightforward to fix: we just need to ensure the path passed to create_dir ends with a /:

.create_dir(convert_path(path.as_ref())?)

I have flagged this as a good first issue.

@Xuanwo Xuanwo added good first issue Good for newcomers help wanted Extra attention is needed labels Dec 2, 2024
@Frank-III
Copy link
Contributor

I would like to work on this one, do we want to check if the path ends with a / or do we want to add it when there is not a / at the end

@Xuanwo
Copy link
Member

Xuanwo commented Dec 2, 2024

I would like to work on this one, do we want to check if the path ends with a / or do we want to add it when there is not a / at the end

Just adding a / should be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants