This was broken only with the new imap_fetch_failure = no-after setting.
return cmd->cancel;
}
- errstr = mailbox_get_last_error(cmd->client->mailbox, &error);
+ if (ctx->error == MAIL_ERROR_NONE)
+ errstr = mailbox_get_last_error(cmd->client->mailbox, &error);
+ else {
+ errstr = ctx->errstr;
+ error = ctx->error;
+ }
if (error == MAIL_ERROR_CONVERSION) {
/* BINARY found unsupported Content-Transfer-Encoding */
tagged_reply = t_strdup_printf(
if (!array_is_created(&ctx->fetch_failed_uids))
p_array_init(&ctx->fetch_failed_uids, ctx->ctx_pool, 8);
seq_range_array_add(&ctx->fetch_failed_uids, ctx->state.cur_mail->uid);
+
+ if (ctx->error == MAIL_ERROR_NONE) {
+ /* preserve the first error, since it may change in storage. */
+ ctx->errstr = p_strdup(ctx->ctx_pool,
+ mailbox_get_last_error(ctx->state.cur_mail->box, &ctx->error));
+ }
return TRUE;
}
struct imap_fetch_state state;
ARRAY_TYPE(seq_range) fetch_failed_uids;
+ enum mail_error error;
+ const char *errstr;
+
bool initialized:1;
bool failures:1;
bool flags_have_handler:1;