Skip to content

fix(server): normalize PUBLIC_APP_URL to origin in pulse emails - #641

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:fix/pulse-app-url-path
Aug 4, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:fix/pulse-app-url-path

Conversation

@d180

@d180 d180 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • If PUBLIC_APP_URL is set with a path (e.g. https://app.example.com/dashboard/insights instead of the bare origin), appUrl() in server/src/lib/pulse/engine.js only stripped a trailing slash, so the path passed through untouched. The pulse engine then appends its own paths, producing doubled URLs like /dashboard/insights/dashboard/insights for the CTA and /dashboard/insights/dashboard/settings?tab=notifications for the manage-notifications footer link — this happened in a real deployment.
  • appUrl() now parses the value with new URL(value).origin (falling back to the raw value if parsing fails) and logs a one-time warning via the existing logger when the configured value contains a path, so the operator learns their env is misconfigured instead of emails silently breaking.
  • Localhost default (http://localhost:3000) behavior is unchanged.

Related issue

Closes #639

Type of change

  • fix — Bug fix

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • npm run lint passes (run from server/; this PR only touches server/, no web/ changes)
  • npm run format:check passes (run from server/)
  • npm run test passes (run from server/, 147/147 tests — no existing test file covers the pulse/ module, so none were added for this small, isolated fix)
  • Changes are focused — one concern per PR

@gkhngyk gkhngyk 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.

Exactly the fix from the issue — origin normalization plus the one-time operator warning. Thanks!

@gkhngyk
gkhngyk merged commit 544f3f1 into ansvisor:main Aug 4, 2026
4 checks passed
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.

Pulse email links silently break when PUBLIC_APP_URL includes a path — normalize to origin and warn

2 participants