From a356cd0d0f4e1908d8acf22438b9ba0d8be9ed81 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sun, 1 Mar 2026 19:49:26 -0800 Subject: [PATCH] Remove unused attachment route path helpers - delete route-to-path conversion helpers from `attachmentPaths` - remove unused `attachmentRoutePath` export and route prefix import --- apps/server/src/attachmentPaths.ts | 22 ---------------------- apps/server/src/attachmentStore.ts | 5 ----- 2 files changed, 27 deletions(-) diff --git a/apps/server/src/attachmentPaths.ts b/apps/server/src/attachmentPaths.ts index 7023d5a3aee0648f5c52d527e6d0426b24e0545a..c1680f6c082f360371fb4cdd35ce93574511c6d3 100644 --- a/apps/server/src/attachmentPaths.ts +++ b/apps/server/src/attachmentPaths.ts @@ -10,14 +10,6 @@ export function normalizeAttachmentRelativePath(rawRelativePath: string): string return normalized.replace(/\\/g, "/"); } -export function attachmentRouteToRelativePath(dataUrl: string): string | null { - const prefix = `${ATTACHMENTS_ROUTE_PREFIX}/`; - if (!dataUrl.startsWith(prefix)) { - return null; - } - return normalizeAttachmentRelativePath(dataUrl.slice(prefix.length)); -} - export function resolveAttachmentRelativePath(input: { readonly stateDir: string; readonly relativePath: string; @@ -34,17 +26,3 @@ export function resolveAttachmentRelativePath(input: { } return filePath; } - -export function resolveAttachmentRoutePath(input: { - readonly stateDir: string; - readonly dataUrl: string; -}): string | null { - const relativePath = attachmentRouteToRelativePath(input.dataUrl); - if (!relativePath) { - return null; - } - return resolveAttachmentRelativePath({ - stateDir: input.stateDir, - relativePath, - }); -} diff --git a/apps/server/src/attachmentStore.ts b/apps/server/src/attachmentStore.ts index 248047e913a4e60c614b5f3cd1950a747789a048..48be2df8a6cfcc053656de8de6835053241587a4 100644 --- a/apps/server/src/attachmentStore.ts +++ b/apps/server/src/attachmentStore.ts @@ -4,7 +4,6 @@ import { existsSync } from "node:fs"; import type { ChatAttachment } from "@t3tools/contracts"; import { - ATTACHMENTS_ROUTE_PREFIX, normalizeAttachmentRelativePath, resolveAttachmentRelativePath, } from "./attachmentPaths.ts"; @@ -77,10 +76,6 @@ export function resolveAttachmentPath(input: { }); } -export function attachmentRoutePath(attachment: ChatAttachment): string { - return `${ATTACHMENTS_ROUTE_PREFIX}/${encodeURIComponent(attachment.id)}`; -} - export function resolveAttachmentPathById(input: { readonly stateDir: string; readonly attachmentId: string; -- 2.54.0