From 25df5c3e2bcc77df8924ccad7478ccfcd621c6e4 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Fri, 18 Apr 2025 20:31:15 +0200 Subject: [PATCH] fix wrong resource id parameter in qthr_save_attachment --- application/store.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/application/store.c b/application/store.c index a434e74..71f968f 100644 --- a/application/store.c +++ b/application/store.c @@ -639,17 +639,16 @@ static int qthr_save_attachment(SaveAttachmentJob *job) { job->error = 1; } else { DBUResult *result = dbuQueryGetResult(q); - int64_t resource_id; - if(dbuResultAsInt64(result, &resource_id)) { + int64_t attachment_resource_id; + if(dbuResultAsInt64(result, &attachment_resource_id)) { job->error = 2; } else { dbuQueryFree(q); q = connection->createQuery(connection, NULL); dbuQuerySetSQL(q, SQL_ATTACHMENT_NEW); - dbuQuerySetParamInt64(q, 1, job->resource_id); + dbuQuerySetParamInt64(q, 1, attachment_resource_id); dbuQuerySetParamInt64(q, 2, job->resource_id); dbuQuerySetParamInt64(q, 3, job->type); - dbuQuerySetParamBytes(q, 4, job->content.ptr, job->content.length); if(dbuQueryExec(q)) { job->error = 3; } else { -- 2.43.5