forked from bolcom/libunftp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdup.rs
36 lines (33 loc) · 1.1 KB
/
cdup.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//! The RFC 959 Change To Parent Directory (`CDUP`) command
//
// This command is a special case of CWD, and is included to
// simplify the implementation of programs for transferring
// directory trees between operating systems having different
// syntaxes for naming the parent directory. The reply codes
// shall be identical to the reply codes of CWD.
use crate::{
auth::UserDetail,
server::controlchan::{
error::ControlChanError,
handler::{CommandContext, CommandHandler},
Reply, ReplyCode,
},
storage::{Metadata, StorageBackend},
};
use async_trait::async_trait;
#[derive(Debug)]
pub struct Cdup;
#[async_trait]
impl<Storage, User> CommandHandler<Storage, User> for Cdup
where
User: UserDetail + 'static,
Storage: StorageBackend<User> + 'static,
Storage::Metadata: Metadata,
{
#[tracing_attributes::instrument]
async fn handle(&self, args: CommandContext<Storage, User>) -> Result<Reply, ControlChanError> {
let mut session = args.session.lock().await;
session.cwd.pop();
Ok(Reply::new(ReplyCode::FileActionOkay, "OK"))
}
}