GODT-2233: Fix sub folder creation bug

Sub folders with more than 2 levels of depth (e.g.: Folders/first/second)
could not be created since we did not update the known label list we use
to validate the request.
This commit is contained in:
Leander Beernaert
2023-01-02 11:41:49 +01:00
parent 6d0a128111
commit 757e8a02ec
2 changed files with 9 additions and 1 deletions

View File

@ -125,7 +125,7 @@ func (conn *imapConnector) createLabel(ctx context.Context, name []string) (imap
}
func (conn *imapConnector) createFolder(ctx context.Context, name []string) (imap.Mailbox, error) {
return safe.RLockRetErr(func() (imap.Mailbox, error) {
return safe.LockRetErr(func() (imap.Mailbox, error) {
var parentID string
if len(name) > 1 {
@ -154,6 +154,9 @@ func (conn *imapConnector) createFolder(ctx context.Context, name []string) (ima
return imap.Mailbox{}, err
}
// Add label to list so subsequent sub folder create requests work correct.
conn.apiLabels[label.ID] = label
return toIMAPMailbox(label, conn.flags, conn.permFlags, conn.attrs), nil
}, conn.apiLabelsLock)
}