melib/imap: quote mailbox names on SELECT/EXAMINE

async
Manos Pitsidianakis 2019-12-10 23:56:25 +02:00
parent a20e08eb43
commit 8235af9237
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
3 changed files with 6 additions and 6 deletions

View File

@ -179,7 +179,7 @@ impl MailBackend for ImapType {
/* first SELECT the mailbox to get READ/WRITE permissions (because EXAMINE only
* returns READ-ONLY for both cases) */
exit_on_error!(&tx,
conn.send_command(format!("SELECT {}", folder_path).as_bytes())
conn.send_command(format!("SELECT \"{}\"", folder_path).as_bytes())
conn.read_response(&mut response)
);
let examine_response = protocol_parser::select_response(&response);
@ -211,7 +211,7 @@ impl MailBackend for ImapType {
}
/* reselecting the same mailbox with EXAMINE prevents expunging it */
exit_on_error!(&tx,
conn.send_command(format!("EXAMINE {}", folder_path).as_bytes())
conn.send_command(format!("EXAMINE \"{}\"", folder_path).as_bytes())
conn.read_response(&mut response)
);
@ -618,7 +618,7 @@ impl ImapType {
let folders_lck = self.folders.read()?;
let mut response = String::with_capacity(8 * 1024);
let mut conn = self.connection.lock()?;
conn.send_command(format!("EXAMINE {}", folders_lck[&folder_hash].path()).as_bytes())?;
conn.send_command(format!("EXAMINE \"{}\"", folders_lck[&folder_hash].path()).as_bytes())?;
conn.read_response(&mut response)?;
conn.send_command(format!("UID SEARCH CHARSET UTF-8 {}", query).as_bytes())?;
conn.read_response(&mut response)?;

View File

@ -78,7 +78,7 @@ impl BackendOp for ImapOp {
let mut response = String::with_capacity(8 * 1024);
{
let mut conn = self.connection.lock().unwrap();
conn.send_command(format!("SELECT {}", self.folder_path).as_bytes())?;
conn.send_command(format!("SELECT \"{}\"", &self.folder_path,).as_bytes())?;
conn.read_response(&mut response)?;
conn.send_command(format!("UID FETCH {} (FLAGS RFC822)", self.uid).as_bytes())?;
conn.read_response(&mut response)?;

View File

@ -148,7 +148,7 @@ pub fn idle(kit: ImapWatchKit) -> Result<()> {
folder_hash,
work_context,
thread_id,
conn.send_command(format!("SELECT {}", folder.path()).as_bytes())
conn.send_command(format!("SELECT \"{}\"", folder.path()).as_bytes())
conn.read_response(&mut response)
);
debug!("select response {}", &response);
@ -519,7 +519,7 @@ fn examine_updates(
folder_hash,
work_context,
thread_id,
conn.send_command(format!("EXAMINE {}", folder.path()).as_bytes())
conn.send_command(format!("EXAMINE \"{}\"", folder.path()).as_bytes())
conn.read_response(&mut response)
);
match protocol_parser::select_response(&response) {