The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 11:00 UTC
Normalize attachment thread segments to lowercase
- Lowercase sanitized thread segments when creating attachment IDs - Add coverage for mixed-case thread IDs in attachment store and projection pipeline tests
Julius Marminge committed
Mar 1, 2026 at 19:18 UTC
58b932ffb8f20566c2c5ac58c252a911c7e80693
3 files changed
+12
-2
apps/server/src/attachmentStore.test.ts
+9
@@ -34,6 +34,15 @@ describe("attachmentStore", () => {
34
expect(parseThreadSegmentFromAttachmentId(fooBarId)).toBe("foo-bar");
35
});
36
37
+ it("normalizes created thread segments to lowercase", () => {
38
+ const attachmentId = createAttachmentId("Thread.Foo");
39
+ expect(attachmentId).toBeTruthy();
40
+ if (!attachmentId) {
41
+ return;
42
+ }
43
+ expect(parseThreadSegmentFromAttachmentId(attachmentId)).toBe("thread-foo");
44
+ });
45
+
46
it("resolves attachment path by id using the extension that exists on disk", () => {
47
const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "t3code-attachment-store-"));
48
try {
apps/server/src/attachmentStore.ts
+1
@@ -23,6 +23,7 @@ const ATTACHMENT_ID_PATTERN = new RegExp(
23
export function toSafeThreadAttachmentSegment(threadId: string): string | null {
24
const segment = threadId
25
.trim()
26
+ .toLowerCase()
27
.replace(/[^a-z0-9_-]+/gi, "-")
28
.replace(/-+/g, "-")
29
.replace(/^[-_]+|[-_]+$/g, "")
apps/server/src/orchestration/Layers/ProjectionPipeline.test.ts
+2
-2
@@ -733,7 +733,7 @@ projectionLayer("OrchestrationProjectionPipeline", (it) => {
733
const projectionPipeline = yield* OrchestrationProjectionPipeline;
734
const eventStore = yield* OrchestrationEventStore;
735
const now = new Date().toISOString();
736
- const threadId = ThreadId.makeUnsafe("thread revert.files");
736
+ const threadId = ThreadId.makeUnsafe("Thread Revert.Files");
737
const keepAttachmentId = "thread-revert-files-00000000-0000-4000-8000-000000000001";
738
const removeAttachmentId = "thread-revert-files-00000000-0000-4000-8000-000000000002";
739
const otherThreadAttachmentId =
@@ -948,7 +948,7 @@ projectionLayer("OrchestrationProjectionPipeline", (it) => {
948
const projectionPipeline = yield* OrchestrationProjectionPipeline;
949
const eventStore = yield* OrchestrationEventStore;
950
const now = new Date().toISOString();
951
- const threadId = ThreadId.makeUnsafe("thread delete.files");
951
+ const threadId = ThreadId.makeUnsafe("Thread Delete.Files");
952
const attachmentId = "thread-delete-files-00000000-0000-4000-8000-000000000001";
953
const otherThreadAttachmentId =
954
"thread-delete-files-extra-00000000-0000-4000-8000-000000000002";