Normalize EVENT_VIEWER_URL trailing slash once in env.ts #16

Merged
matt merged 1 commit from mailship-aee-extract-shared-normalized-event-viewer-u-671 into main 2026-09-16 13:44:39 +00:00
Collaborator

mailship-aee

Consolidate the duplicated EVENT_VIEWER_URL.replace(/\/$/, '') trailing-slash strip (occurring 6 times across 3 files) into a single normalization at the export source in env.ts.

Changes

  • src/env.ts — The EVENT_VIEWER_URL export now strips a trailing slash at definition time. BRAND_LOGO no longer needs an ad-hoc strip.
  • src/server.ts — Removed 3× .replace(/\/$/, '') in the /confirm route's settingsUrl templates.
  • src/mailer.ts — Removed 2× .replace(/\/$/, '') in sendConfirm and sendDigest. The unrelated protocol-prefix strip (/^https?:\/\//) is preserved for the link display text.

How to test

Run bash script/checks — type-check, lint, build, and all 16 unit tests must pass. No behavioral change is expected; the regex is identical, just applied earlier.

mailship-aee Consolidate the duplicated `EVENT_VIEWER_URL.replace(/\/$/, '')` trailing-slash strip (occurring 6 times across 3 files) into a single normalization at the export source in `env.ts`. **Changes** - **`src/env.ts`** — The `EVENT_VIEWER_URL` export now strips a trailing slash at definition time. `BRAND_LOGO` no longer needs an ad-hoc strip. - **`src/server.ts`** — Removed 3× `.replace(/\/$/, '')` in the `/confirm` route's `settingsUrl` templates. - **`src/mailer.ts`** — Removed 2× `.replace(/\/$/, '')` in `sendConfirm` and `sendDigest`. The unrelated protocol-prefix strip (`/^https?:\/\//`) is preserved for the link display text. **How to test** Run `bash script/checks` — type-check, lint, build, and all 16 unit tests must pass. No behavioral change is expected; the regex is identical, just applied earlier.
hudson added 1 commit 2026-09-16 13:29:49 +00:00
Normalize EVENT_VIEWER_URL trailing slash once in env.ts, remove 6 ad-hoc strips
All checks were successful
CI / checks (pull_request) Successful in 35s
dbde1ec02d
EVENT_VIEWER_URL.replace(/\/$/, '') was duplicated across:
- env.ts (BRAND_LOGO, 1x)
- server.ts (settingsUrl in confirm routes, 3x)
- mailer.ts (settingsUrl in sendConfirm/sendDigest, 2x)

Now trailing-slash normalization happens at the export source in env.ts,
so all consumers get a clean URL without ad-hoc stripping.
matt approved these changes 2026-09-16 13:44:35 +00:00
matt merged commit e86ffbed15 into main 2026-09-16 13:44:39 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: matt/mailship#16
No description provided.