authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-03-01 19:49:26-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-03-01 20:06:21-08:00
loga356cd0d0f4e1908d8acf22438b9ba0d8be9ed81
treef996da1ff45ed5d0e8cc0797097d542f7e5aca38
parent58b932ffb8f20566c2c5ac58c252a911c7e80693

Remove unused attachment route path helpers

- delete route-to-path conversion helpers from `attachmentPaths` - remove unused `attachmentRoutePath` export and route prefix import

2 files changed, 0 insertions(+), 27 deletions(-)

apps/server/src/attachmentPaths.ts-22
...@@ -10,14 +10,6 @@ export function normalizeAttachmentRelativePath(rawRelativePath: string): string...@@ -10,14 +10,6 @@ export function normalizeAttachmentRelativePath(rawRelativePath: string): string
10 return normalized.replace(/\\/g, "/");10 return normalized.replace(/\\/g, "/");
11}11}
1212
13export function attachmentRouteToRelativePath(dataUrl: string): string | null {
14 const prefix = `${ATTACHMENTS_ROUTE_PREFIX}/`;
15 if (!dataUrl.startsWith(prefix)) {
16 return null;
17 }
18 return normalizeAttachmentRelativePath(dataUrl.slice(prefix.length));
19}
20
21export function resolveAttachmentRelativePath(input: {13export function resolveAttachmentRelativePath(input: {
22 readonly stateDir: string;14 readonly stateDir: string;
23 readonly relativePath: string;15 readonly relativePath: string;
...@@ -34,17 +26,3 @@ export function resolveAttachmentRelativePath(input: {...@@ -34,17 +26,3 @@ export function resolveAttachmentRelativePath(input: {
34 }26 }
35 return filePath;27 return filePath;
36}28}
37
38export function resolveAttachmentRoutePath(input: {
39 readonly stateDir: string;
40 readonly dataUrl: string;
41}): string | null {
42 const relativePath = attachmentRouteToRelativePath(input.dataUrl);
43 if (!relativePath) {
44 return null;
45 }
46 return resolveAttachmentRelativePath({
47 stateDir: input.stateDir,
48 relativePath,
49 });
50}
apps/server/src/attachmentStore.ts-5
...@@ -4,7 +4,6 @@ import { existsSync } from "node:fs";...@@ -4,7 +4,6 @@ import { existsSync } from "node:fs";
4import type { ChatAttachment } from "@t3tools/contracts";4import type { ChatAttachment } from "@t3tools/contracts";
55
6import {6import {
7 ATTACHMENTS_ROUTE_PREFIX,
8 normalizeAttachmentRelativePath,7 normalizeAttachmentRelativePath,
9 resolveAttachmentRelativePath,8 resolveAttachmentRelativePath,
10} from "./attachmentPaths.ts";9} from "./attachmentPaths.ts";
...@@ -77,10 +76,6 @@ export function resolveAttachmentPath(input: {...@@ -77,10 +76,6 @@ export function resolveAttachmentPath(input: {
77 });76 });
78}77}
7978
80export function attachmentRoutePath(attachment: ChatAttachment): string {
81 return `${ATTACHMENTS_ROUTE_PREFIX}/${encodeURIComponent(attachment.id)}`;
82}
83
84export function resolveAttachmentPathById(input: {79export function resolveAttachmentPathById(input: {
85 readonly stateDir: string;80 readonly stateDir: string;
86 readonly attachmentId: string;81 readonly attachmentId: string;