From 9aa387a4732ae9a431933edfb76c1a6e3c3e2f89 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 11 Dec 2025 18:40:13 +0100 Subject: [PATCH] :bug: Fix incorrect string truncation with abbreviate template filter --- CHANGES.md | 1 + backend/resources/app/email/invite-to-team/en.html | 2 +- backend/src/app/util/template.clj | 8 ++++++++ common/deps.edn | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 011361113a..6b941393c3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -95,6 +95,7 @@ example. It's still usable as before, we just removed the example. - Fix switch variants with paths [Taiga #12841](https://tree.taiga.io/project/penpot/issue/12841) - Fix referencing typography tokens on font-family tokens [Taiga #12492](https://tree.taiga.io/project/penpot/issue/12492) - Fix horizontal scroll on layer panel [Taiga #12843](https://tree.taiga.io/project/penpot/issue/12843) +- Fix unicode handling on email template abbreviation filter [Github #7966](https://github.com/penpot/penpot/pull/7966) ## 2.11.1 diff --git a/backend/resources/app/email/invite-to-team/en.html b/backend/resources/app/email/invite-to-team/en.html index 5e61f1f675..337593902d 100644 --- a/backend/resources/app/email/invite-to-team/en.html +++ b/backend/resources/app/email/invite-to-team/en.html @@ -240,4 +240,4 @@ - \ No newline at end of file + diff --git a/backend/src/app/util/template.clj b/backend/src/app/util/template.clj index 5c7a0b8c6e..2365423349 100644 --- a/backend/src/app/util/template.clj +++ b/backend/src/app/util/template.clj @@ -7,10 +7,18 @@ (ns app.util.template (:require [app.common.exceptions :as ex] + [cuerdas.core :as str] + [selmer.filters :as sf] [selmer.parser :as sp])) ;; (sp/cache-off!) +(sf/add-filter! :abbreviate + (fn [s n] + (let [n (parse-long n)] + (str/abbreviate s n)))) + + (defn render [path context] (try diff --git a/common/deps.edn b/common/deps.edn index a2d9a1b1ec..e7e73645a5 100644 --- a/common/deps.edn +++ b/common/deps.edn @@ -30,7 +30,7 @@ integrant/integrant {:mvn/version "1.0.0"} funcool/tubax {:mvn/version "2021.05.20-0"} - funcool/cuerdas {:mvn/version "2025.06.16-414"} + funcool/cuerdas {:mvn/version "2026.415"} funcool/promesa {:git/sha "46048fc0d4bf5466a2a4121f5d52aefa6337f2e8" :git/url "https://github.com/funcool/promesa"}