Skip to content

fix(notifications): don't re-escape email vars for each recipient#2805

Merged
rhafer merged 1 commit into
opencloud-eu:mainfrom
michaelstingl:fix-2804-email-double-escape
May 21, 2026
Merged

fix(notifications): don't re-escape email vars for each recipient#2805
rhafer merged 1 commit into
opencloud-eu:mainfrom
michaelstingl:fix-2804-email-double-escape

Conversation

@michaelstingl
Copy link
Copy Markdown
Contributor

Description

escapeStringMap mutated its input map. The recipient loop in eventsNotifier.render reuses that map across iterations, so each recipient past the first got values with one extra HTML escape layer. Return a new map instead.

Related Issue

Motivation and Context

Hit in production on 6.1.0 with a group invite to a space whose name contained &.

How Has This Been Tested?

  • go vet and go test ./services/notifications/... clean
  • new TestEscapeStringMapDoesNotMutateInput passes on the fix, fails on the pre-fix helper
  • golangci-lint v1.64.6 clean for the change

Types of changes

  • Bug fix

Checklist

  • Code changes
  • Unit tests added
  • Documentation added (changelog entry)

🤖 drafted with Claude Code, reviewed before submitting.

escapeStringMap mutated its input map. The recipient loop in eventsNotifier.render reuses that map across iterations, so each recipient past the first got values with one extra HTML escape layer. Return a new map instead.

Fixes opencloud-eu#2804

Signed-off-by: Michael Stingl <mail@michaelstingl.com>
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 20, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation (-1.00%)
Diff coverage 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1462301) 81224 18669 22.98%
Head commit (12206e3) 81225 (+1) 18673 (+4) 22.99% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#2805) 4 4 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@rhafer rhafer enabled auto-merge May 21, 2026 09:32
@rhafer rhafer merged commit a52de9f into opencloud-eu:main May 21, 2026
64 checks passed
@openclouders openclouders mentioned this pull request May 21, 2026
1 task
@michaelstingl michaelstingl deleted the fix-2804-email-double-escape branch May 21, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notification emails escape HTML entities multiple times when sent to a group

2 participants