| author | |
| committer | |
| log | a356cd0d0f4e1908d8acf22438b9ba0d8be9ed81 |
| tree | f996da1ff45ed5d0e8cc0797097d542f7e5aca38 |
| parent | 58b932ffb8f20566c2c5ac58c252a911c7e80693 |
- delete route-to-path conversion helpers from `attachmentPaths`
- remove unused `attachmentRoutePath` export and route prefix import2 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 | } |
| 12 | 12 | ||
| 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 | |||
| 21 | export function resolveAttachmentRelativePath(input: { | 13 | export 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 | |||
| 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-5| ... | @@ -4,7 +4,6 @@ import { existsSync } from "node:fs"; | ... | @@ -4,7 +4,6 @@ import { existsSync } from "node:fs"; |
| 4 | import type { ChatAttachment } from "@t3tools/contracts"; | 4 | import type { ChatAttachment } from "@t3tools/contracts"; |
| 5 | 5 | ||
| 6 | import { | 6 | import { |
| 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 | } |
| 79 | 78 | ||
| 80 | export function attachmentRoutePath(attachment: ChatAttachment): string { | ||
| 81 | return `${ATTACHMENTS_ROUTE_PREFIX}/${encodeURIComponent(attachment.id)}`; | ||
| 82 | } | ||
| 83 | |||
| 84 | export function resolveAttachmentPathById(input: { | 79 | export function resolveAttachmentPathById(input: { |
| 85 | readonly stateDir: string; | 80 | readonly stateDir: string; |
| 86 | readonly attachmentId: string; | 81 | readonly attachmentId: string; |