mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
feat(GODT-2283): Limit max import size to 30MB (bump GPA to v0.4.0)
This commit is contained in:
@ -124,14 +124,19 @@ func (t *testCtx) withAddrKR(
|
||||
func (t *testCtx) createMessages(ctx context.Context, username, addrID string, req []proton.ImportReq) error {
|
||||
return t.withClient(ctx, username, func(ctx context.Context, c *proton.Client) error {
|
||||
return t.withAddrKR(ctx, c, username, addrID, func(ctx context.Context, addrKR *crypto.KeyRing) error {
|
||||
if _, err := stream.Collect(ctx, c.ImportMessages(
|
||||
str, err := c.ImportMessages(
|
||||
ctx,
|
||||
addrKR,
|
||||
runtime.NumCPU(),
|
||||
runtime.NumCPU(),
|
||||
req...,
|
||||
)); err != nil {
|
||||
return err
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to prepare messages for import: %w", err)
|
||||
}
|
||||
|
||||
if _, err := stream.Collect(ctx, str); err != nil {
|
||||
return fmt.Errorf("failed to import messages: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user