TypeScript
nit
Julius Marminge5144d32b771c
diff --git a/apps/server/src/attachmentPaths.ts b/apps/server/src/attachmentPaths.tsindex cb0e8e43a86..f9fb6056691 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.tsindex 249deff0ca8..f808cefdcd2 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<string, string> = {"image/avif": ".avif","image/bmp": ".bmp",diff --git a/apps/server/src/orchestration/Layers/ProjectionPipeline.ts b/apps/server/src/orchestration/Layers/ProjectionPipeline.tsindex 15093a62d6f..45e6196b502 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.tsindex 4f4315791da..4d66f0e86f3 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<string, string> = {".png": "image/png",".jpg": "image/jpeg",diff --git a/apps/server/src/wsServer.ts b/apps/server/src/wsServer.tsindex ac978806d27..85991dc2bbf 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.