Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

fix path considering the directory hierarchy #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ impl<S> Session<S>
Some(ExternalCommand(Command::Retr{path})) => {
let tx_sending = tx.clone();
let tx_error = tx.clone();
let path = cwd.join(path);
tokio::spawn(
storage.get(path)
.map_err(|_| std::io::Error::new(ErrorKind::Other, "Failed to get file"))
Expand Down Expand Up @@ -335,6 +336,7 @@ impl<S> Session<S>
Some(ExternalCommand(Command::Stor{path})) => {
let tx_ok = tx.clone();
let tx_error = tx.clone();
let path = cwd.join(path);
tokio::spawn(
storage.put(socket, path)
.map_err(|_| std::io::Error::new(ErrorKind::Other, "Failed to put file"))
Expand Down Expand Up @@ -860,6 +862,7 @@ impl<S> Server<S>
let storage = Arc::clone(&session.storage);
let tx_success = tx.clone();
let tx_fail = tx.clone();
let path = &session.cwd.join(path);
tokio::spawn(
storage.del(path)
.map_err(|_| std::io::Error::new(ErrorKind::Other, "Failed to delete file"))
Expand Down Expand Up @@ -889,8 +892,9 @@ impl<S> Server<S>
let storage = Arc::clone(&session.storage);
let tx_success = tx.clone();
let tx_fail = tx.clone();
let mkd_path = &session.cwd.join(&path);
tokio::spawn(
storage.mkd(&path)
storage.mkd(&mkd_path)
.map_err(|_| std::io::Error::new(ErrorKind::Other, "Failed to create directory"))
.and_then(|_| {
tx_success.send(InternalMsg::MkdirSuccess(path))
Expand Down