Remove unused attachment route path helpers
- delete route-to-path conversion helpers from `attachmentPaths` - remove unused `attachmentRoutePath` export and route prefix import
This commit is contained in:
1 parent
58b932ffb8
commit
a356cd0d0f
2 files changed
-27
No files matched your search
@@ -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,
|
||||
});
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user