diff --git a/apps/server/src/attachmentPaths.ts b/apps/server/src/attachmentPaths.ts index cb0e8e43a862a797434bb8c51f633d991957aae3..f9fb6056691061b3580ff10b55ecdeb8c38bb596 100644 --- a/apps/server/src/attachmentPaths.ts +++ b/apps/server/src/attachmentPaths.ts @@ -1,14 +1,10 @@ import path from "node:path"; -import { ATTACHMENTS_ROUTE_PREFIX } from "./projectFaviconRoute.ts"; +import { ATTACHMENTS_ROUTE_PREFIX } from "./imageMime.ts"; export function normalizeAttachmentRelativePath(rawRelativePath: string): string | null { const normalized = path.normalize(rawRelativePath).replace(/^[/\\]+/, ""); - if ( - normalized.length === 0 || - normalized.startsWith("..") || - normalized.includes("\0") - ) { + if (normalized.length === 0 || normalized.startsWith("..") || normalized.includes("\0")) { return null; } return normalized.replace(/\\/g, "/"); diff --git a/apps/server/src/imageMime.ts b/apps/server/src/imageMime.ts index 249deff0ca8efb37a8708c6fbe3039a9aa3a2ca4..f808cefdcd24ba980cb2749a178783b57c05941d 100644 --- a/apps/server/src/imageMime.ts +++ b/apps/server/src/imageMime.ts @@ -1,5 +1,7 @@ import Mime from "@effect/platform-node/Mime"; +export const ATTACHMENTS_ROUTE_PREFIX = "/attachments"; + export const IMAGE_EXTENSION_BY_MIME_TYPE: Record = { "image/avif": ".avif", "image/bmp": ".bmp", diff --git a/apps/server/src/orchestration/Layers/ProjectionPipeline.ts b/apps/server/src/orchestration/Layers/ProjectionPipeline.ts index 15093a62d6f6a5713953d096b84a61b00436f4c0..45e6196b5027237164462a4507cb73047dee0647 100644 --- a/apps/server/src/orchestration/Layers/ProjectionPipeline.ts +++ b/apps/server/src/orchestration/Layers/ProjectionPipeline.ts @@ -38,8 +38,11 @@ import { type OrchestrationProjectionPipelineShape, } from "../Services/ProjectionPipeline.ts"; import { attachmentRouteToRelativePath } from "../../attachmentPaths.ts"; -import { ATTACHMENTS_ROUTE_PREFIX } from "../../projectFaviconRoute.ts"; -import { inferImageExtension, parseBase64DataUrl } from "../../imageMime.ts"; +import { + ATTACHMENTS_ROUTE_PREFIX, + inferImageExtension, + parseBase64DataUrl, +} from "../../imageMime.ts"; export const ORCHESTRATION_PROJECTOR_NAMES = { projects: "projection.projects", diff --git a/apps/server/src/projectFaviconRoute.ts b/apps/server/src/projectFaviconRoute.ts index 4f4315791da08b029ead4537479e63de5d09f468..4d66f0e86f3156ef6c7f194969acbab0b0ac2ea5 100644 --- a/apps/server/src/projectFaviconRoute.ts +++ b/apps/server/src/projectFaviconRoute.ts @@ -2,8 +2,6 @@ import fs from "node:fs"; import http from "node:http"; import path from "node:path"; -export const ATTACHMENTS_ROUTE_PREFIX = "/attachments"; - const FAVICON_MIME_TYPES: Record = { ".png": "image/png", ".jpg": "image/jpeg", diff --git a/apps/server/src/wsServer.ts b/apps/server/src/wsServer.ts index ac978806d27722db4bb8298859381285859ecf29..85991dc2bbf8d22c80be7e4cb93df4201d0bb32d 100644 --- a/apps/server/src/wsServer.ts +++ b/apps/server/src/wsServer.ts @@ -54,8 +54,9 @@ import { clamp } from "effect/Number"; import { Open } from "./open"; import { ServerConfig } from "./config"; import { GitCore } from "./git/Services/GitCore.ts"; -import { ATTACHMENTS_ROUTE_PREFIX, tryHandleProjectFaviconRequest } from "./projectFaviconRoute"; +import { tryHandleProjectFaviconRequest } from "./projectFaviconRoute"; import { normalizeAttachmentRelativePath, resolveAttachmentRelativePath } from "./attachmentPaths"; +import { ATTACHMENTS_ROUTE_PREFIX } from "./imageMime.ts"; /** * ServerShape - Service API for server lifecycle control.