From 8aea0cf54dc670616e26c2a476e3f02511f60cba Mon Sep 17 00:00:00 2001 From: lvyanpu Date: Tue, 24 Nov 2026 23:55:25 +0800 Subject: [PATCH 1/2] fix(web): keep emoji intact in manually added folder names --- .../settings/trackedFolders.logic.test.ts | 19 +++++++++++++++++++ .../settings/trackedFolders.logic.ts | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/settings/trackedFolders.logic.test.ts b/apps/web/src/components/settings/trackedFolders.logic.test.ts index 319e9221faba8..28e945f276689 100644 --- a/apps/web/src/components/settings/trackedFolders.logic.test.ts +++ b/apps/web/src/components/settings/trackedFolders.logic.test.ts @@ -15,6 +15,10 @@ describe("trackedFolderDisplayPath", () => { }); describe("resolveTrackedFolderInput", () => { + const fittingName = `${"a".repeat(126)}🚀`; + const overflowingPath = `/srv/${"a".repeat(127)}🚀`; + const paddedPath = `/srv/${" ".repeat(127)}🚀`; + it.each([ [ "an absolute path that is not listed", @@ -35,6 +39,21 @@ describe("resolveTrackedFolderInput", () => { }, { path: "/home/me/code/tools", name: "tools" }, ], + [ + "an emoji ending at the name limit", + { query: `/srv/${fittingName}`, listedDirectoryPath: null, exactEntryPath: null }, + { path: `/srv/${fittingName}`, name: fittingName }, + ], + [ + "an emoji crossing the name limit", + { query: overflowingPath, listedDirectoryPath: null, exactEntryPath: null }, + { path: overflowingPath, name: "a".repeat(127) }, + ], + [ + "an emoji after leading whitespace at the name limit", + { query: paddedPath, listedDirectoryPath: null, exactEntryPath: null }, + { path: paddedPath, name: "🚀" }, + ], [ "a directory name longer than a folder name may be", { diff --git a/apps/web/src/components/settings/trackedFolders.logic.ts b/apps/web/src/components/settings/trackedFolders.logic.ts index a0b6a23c1120c..3f86bef450ec6 100644 --- a/apps/web/src/components/settings/trackedFolders.logic.ts +++ b/apps/web/src/components/settings/trackedFolders.logic.ts @@ -1,5 +1,6 @@ import type { ProjectTrackedFolder } from "@t3tools/contracts"; import { hasTrailingPathSeparator } from "@t3tools/client-runtime/state/projects"; +import { splitsSurrogatePair } from "@t3tools/shared/assistantCitations"; import { fileBasename, isAbsolutePath, @@ -34,7 +35,8 @@ export function resolveTrackedFolderInput(input: { if (rawPath === null) return null; const path = normalizeProjectPathForDispatch(rawPath); // `ProjectTrackedFolder.name` takes at most 128 characters. - const name = fileBasename(path).slice(0, 128).trim(); + const basename = fileBasename(path).trimStart(); + const name = basename.slice(0, splitsSurrogatePair(basename, 128) ? 127 : 128).trimEnd(); if (path.length === 0 || name.length === 0) return null; return { path, name }; } From abe60bf78c2358c2663f0c310b09a31686857908 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 24 Nov 2026 16:09:43 +0000 Subject: [PATCH 2/2] test(web): keep only the tracked folder name cases that catch a regression Co-Authored-By: Claude Opus 5.5 --- .../src/components/settings/trackedFolders.logic.test.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/apps/web/src/components/settings/trackedFolders.logic.test.ts b/apps/web/src/components/settings/trackedFolders.logic.test.ts index 28e945f276689..163c4f804d10a 100644 --- a/apps/web/src/components/settings/trackedFolders.logic.test.ts +++ b/apps/web/src/components/settings/trackedFolders.logic.test.ts @@ -15,7 +15,6 @@ describe("trackedFolderDisplayPath", () => { }); describe("resolveTrackedFolderInput", () => { - const fittingName = `${"a".repeat(126)}🚀`; const overflowingPath = `/srv/${"a".repeat(127)}🚀`; const paddedPath = `/srv/${" ".repeat(127)}🚀`; @@ -39,11 +38,6 @@ describe("resolveTrackedFolderInput", () => { }, { path: "/home/me/code/tools", name: "tools" }, ], - [ - "an emoji ending at the name limit", - { query: `/srv/${fittingName}`, listedDirectoryPath: null, exactEntryPath: null }, - { path: `/srv/${fittingName}`, name: fittingName }, - ], [ "an emoji crossing the name limit", { query: overflowingPath, listedDirectoryPath: null, exactEntryPath: null },