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:
@ -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) {
|
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
|
var parentID string
|
||||||
|
|
||||||
if len(name) > 1 {
|
if len(name) > 1 {
|
||||||
@ -154,6 +154,9 @@ func (conn *imapConnector) createFolder(ctx context.Context, name []string) (ima
|
|||||||
return imap.Mailbox{}, err
|
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
|
return toIMAPMailbox(label, conn.flags, conn.permFlags, conn.attrs), nil
|
||||||
}, conn.apiLabelsLock)
|
}, conn.apiLabelsLock)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -187,3 +187,8 @@ Feature: IMAP create mailbox
|
|||||||
| Labels |
|
| Labels |
|
||||||
| Labels/l1 |
|
| Labels/l1 |
|
||||||
| Labels/l2 |
|
| Labels/l2 |
|
||||||
|
|
||||||
|
Scenario: Create 2 levels deep Folder
|
||||||
|
When IMAP client "1" creates "Folders/first/second"
|
||||||
|
And it succeeds
|
||||||
|
Then IMAP client "1" sees "Folders/first/second"
|
||||||
|
|||||||
Reference in New Issue
Block a user