Skip to content

Commit 7971ba8

Browse files
committed
Address CodeRabbit feedback
- Add guard for missing upload token and fail fast with clear error message - Remove duplicate summary emission from uploadFiles method - Use actual upload token count instead of input array length for summary
1 parent ad7df8a commit 7971ba8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

components/zendesk/actions/update-ticket/update-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default {
128128
},
129129
});
130130

131-
const attachmentCount = attachments?.length || 0;
131+
const attachmentCount = ticketComment.uploads?.length || 0;
132132
const summary = attachmentCount > 0
133133
? `Successfully updated ticket with ID ${response.ticket.id} with ${attachmentCount} attachment(s)`
134134
: `Successfully updated ticket with ID ${response.ticket.id}`;

components/zendesk/zendesk.app.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,12 @@ export default {
347347
customSubdomain,
348348
step,
349349
});
350-
uploadResults.push(result.upload.token);
350+
const token = result?.upload?.token;
351+
if (!token) {
352+
throw new Error(`Upload API returned no token for ${attachment}`);
353+
}
354+
uploadResults.push(token);
351355
} catch (error) {
352-
step.export("$summary", `Failed to upload file ${attachment}: ${error.message}`);
353356
throw error;
354357
}
355358
}

0 commit comments

Comments
 (0)