History

Remove unused attachment route path helpers

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

Julius Marminge committed 8 months ago

Commit a356cd01 parent 58b932f2 files · +0 −27Browse files

Unified · Split

2 files
  1. apps/server/src/attachmentPaths.ts +0 −22
  2. apps/server/src/attachmentStore.ts +0 −5
apps/server/src/attachmentPaths.ts+0−22
@@ -10,14 +10,6 @@ export function normalizeAttachmentRelativePath(rawRelativePath: string): string · 9 unmodified lines
1010 return normalized.replace(/\\/g, "/");
1111 }
1212
13−export 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−
2113 export function resolveAttachmentRelativePath(input: {
2214 readonly stateDir: string;
2315 readonly relativePath: string;
@@ -34,17 +26,3 @@ export function resolveAttachmentRelativePath(input: { · 10 unmodified lines
3426 }
3527 return filePath;
3628 }
37−
38−export 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+0−5
@@ -4,7 +4,6 @@ import { existsSync } from "node:fs"; · 3 unmodified lines
44 import type { ChatAttachment } from "@t3tools/contracts";
55
66 import {
7− ATTACHMENTS_ROUTE_PREFIX,
87 normalizeAttachmentRelativePath,
98 resolveAttachmentRelativePath,
109 } from "./attachmentPaths.ts";
@@ -77,10 +76,6 @@ export function resolveAttachmentPath(input: { · 66 unmodified lines
7776 });
7877 }
7978
80−export function attachmentRoutePath(attachment: ChatAttachment): string {
81− return `${ATTACHMENTS_ROUTE_PREFIX}/${encodeURIComponent(attachment.id)}`;
82−}
83−
8479 export function resolveAttachmentPathById(input: {
8580 readonly stateDir: string;
8681 readonly attachmentId: string;