Skip to content

fix(communications): guard template list handlers when params are missing - #1567

Merged
kkopanidis merged 3 commits into
mainfrom
fix/communications-getTemplates-params-guard
Aug 3, 2026
Merged

fix(communications): guard template list handlers when params are missing#1567
kkopanidis merged 3 commits into
mainfrom
fix/communications-getTemplates-params-guard

Conversation

@CluelessBiker

@CluelessBiker CluelessBiker commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Defaults call.request.params to {} in getTemplates and getCommunicationTemplates.
  • Prevents destructuring undefined when list requests arrive without query parameters.

Why

GET /email/templates with no query string could throw before the handler ran, returning a 500 instead of an empty or paginated result. This hardens the admin API against a class of request-shape failures seen when the Conduit UI loads templates on page entry.

Related PR

Test plan

  • Call GET /email/templates with no query params — returns 200 with templateDocuments and count.
  • Call GET /communications/templates with no query params — same behavior.
  • Existing skip/limit/search filtering still works.

…sing

Default call.request.params to an empty object in getTemplates and
getCommunicationTemplates to avoid destructuring undefined on requests
with no query string.

@kkopanidis kkopanidis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the reasonable defaults of skip 0 and limit 25 is an unwanted behavior. The APIs provide this default so users cannot accidentally request very large chunks of data. The rest of the parameters were already guarded, not so cleanly of course, but we must preserver the defaults

…dlers

Preserve skip=0 and limit=25 when query params are missing while keeping
the params null-guard that prevents 500s on unparameterized list requests.
@kkopanidis
kkopanidis merged commit 2cb100e into main Aug 3, 2026
7 checks passed
@kkopanidis
kkopanidis deleted the fix/communications-getTemplates-params-guard branch August 3, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants