mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-10-08 19:45:49 +08:00
Case insensitive INBOX on fileinto (fixes #763)
This commit is contained in:
parent
51c8f7b279
commit
39d0a168d4
2 changed files with 20 additions and 7 deletions
|
@ -15,6 +15,8 @@ use trc::AddContext;
|
||||||
|
|
||||||
use crate::{auth::acl::EffectiveAcl, JMAP};
|
use crate::{auth::acl::EffectiveAcl, JMAP};
|
||||||
|
|
||||||
|
use super::INBOX_ID;
|
||||||
|
|
||||||
impl JMAP {
|
impl JMAP {
|
||||||
pub async fn mailbox_get(
|
pub async fn mailbox_get(
|
||||||
&self,
|
&self,
|
||||||
|
@ -317,16 +319,27 @@ impl JMAP {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut filter = Vec::with_capacity(path.len() + 2);
|
let mut filter = Vec::with_capacity(path.len() + 2);
|
||||||
|
let mut has_inbox = false;
|
||||||
filter.push(Filter::Or);
|
filter.push(Filter::Or);
|
||||||
for &item in &path {
|
for (pos, item) in path.iter().enumerate() {
|
||||||
filter.push(Filter::eq(Property::Name, item));
|
if pos == 0 && item.eq_ignore_ascii_case("inbox") {
|
||||||
|
has_inbox = true;
|
||||||
|
} else {
|
||||||
|
filter.push(Filter::eq(Property::Name, *item));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
filter.push(Filter::End);
|
filter.push(Filter::End);
|
||||||
|
|
||||||
let document_ids = self
|
let mut document_ids = if filter.len() > 2 {
|
||||||
.filter(account_id, Collection::Mailbox, filter)
|
self.filter(account_id, Collection::Mailbox, filter)
|
||||||
.await?
|
.await?
|
||||||
.results;
|
.results
|
||||||
|
} else {
|
||||||
|
RoaringBitmap::new()
|
||||||
|
};
|
||||||
|
if has_inbox {
|
||||||
|
document_ids.insert(INBOX_ID);
|
||||||
|
}
|
||||||
if exact_match && (document_ids.len() as usize) < path.len() {
|
if exact_match && (document_ids.len() as usize) < path.len() {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ if not mailboxexists ["Drafts", "Sent Items"] {
|
||||||
}
|
}
|
||||||
|
|
||||||
# File into new mailboxes using flags
|
# File into new mailboxes using flags
|
||||||
fileinto :create "Inbox / Folder ";
|
fileinto :create "INBOX / Folder ";
|
||||||
fileinto :flags ["$important", "$seen"] :create "My/Nested/Mailbox/with/multiple/levels";
|
fileinto :flags ["$important", "$seen"] :create "My/Nested/Mailbox/with/multiple/levels";
|
||||||
|
|
||||||
# Make sure all mailboxes were created
|
# Make sure all mailboxes were created
|
||||||
|
|
Loading…
Add table
Reference in a new issue