From 9c952be56a59fa8ff2fd094d902f8b5c59af00b7 Mon Sep 17 00:00:00 2001 From: 29 <791603901@qq.com> Date: Mon, 5 Aug 2024 18:14:33 +0800 Subject: [PATCH] Truncate instead of reject user's >100 char input --- src/server/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/mod.rs b/src/server/mod.rs index 26eb995..a6651c2 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -10,6 +10,7 @@ use once_cell::sync::Lazy; use route_recognizer::{Params, Router}; use semver::VersionReq; use serde::Deserialize; +use unicode_ellipsis::truncate_str; mod assets; mod views; @@ -475,7 +476,8 @@ impl ExtraConfig { .0, subject: extra_config .subject - .filter(|t| t.len() <= MAX_WIDTH && !t.is_empty()), + .filter(|t| !t.is_empty()) + .map(|t| truncate_str(&t, MAX_WIDTH).into()), path: extra_config.path, } }