From a7aba2da2f98eea2aea4c7f6d7529569bf9e1c9e Mon Sep 17 00:00:00 2001 From: Oleksander Piskun Date: Tue, 26 May 2026 06:27:33 +0000 Subject: [PATCH] fix: avoid vsprintf ValueError in non-English notification locales Use %n for the plural counter instead of %s in the "new open tickets" message. With %s, Nextcloud's L10N pipeline never passes %count% to Symfony's IdentityTranslator, so the imploded "singular|plural" translation is returned verbatim and vsprintf trips on the extra %s placeholders, breaking the notifications API and mail cron for every non-English user. Same bug pattern as nextcloud/integration_github#197. Signed-off-by: Oleksander Piskun --- CHANGELOG.md | 1 + lib/Notification/Notifier.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 085b529..238ad88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Stop spamming the log with `\InvalidArgumentException` deprecation warnings from the notifier; throw `OCP\Notification\UnknownNotificationException` instead for unknown notifications. +- Fix `ValueError` from `vsprintf()` that broke notifications for non-English users. ## 1.4.1 - 2025-11-10 diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 6739715..7b1110d 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -80,7 +80,7 @@ public function prepare(INotification $notification, string $languageCode): INot case 'new_open_tickets': $p = $notification->getSubjectParameters(); $nbOpen = (int)($p['nbOpen'] ?? 0); - $content = $l->n('You have %s open issue with recent activity in Jira.', 'You have %s open issues with recent activity in Jira.', $nbOpen, [$nbOpen]); + $content = $l->n('You have %n open issue with recent activity in Jira.', 'You have %n open issues with recent activity in Jira.', $nbOpen); //$theme = $this->config->getUserValue($userId, 'accessibility', 'theme', ''); //$iconUrl = ($theme === 'dark')