| author | |
| committer | |
| log | 5144d32b771cb64c7e6e7aa0d109e480a4382a01 |
| tree | 9a3ae351f8c5a36dd6724b5c3a9914395effb17e |
| parent | 128cc215167cfd2c9696cdc657c870954d972db2 |
5 files changed, 11 insertions(+), 11 deletions(-)
apps/server/src/attachmentPaths.ts+2-6| ... | ... | @@ -1,14 +1,10 @@ |
| 1 | 1 | import path from "node:path"; |
| 2 | 2 | |
| 3 | import { ATTACHMENTS_ROUTE_PREFIX } from "./projectFaviconRoute.ts"; | |
| 3 | import { ATTACHMENTS_ROUTE_PREFIX } from "./imageMime.ts"; | |
| 4 | 4 | |
| 5 | 5 | export function normalizeAttachmentRelativePath(rawRelativePath: string): string | null { |
| 6 | 6 | const normalized = path.normalize(rawRelativePath).replace(/^[/\\]+/, ""); |
| 7 | if ( | |
| 8 | normalized.length === 0 || | |
| 9 | normalized.startsWith("..") || | |
| 10 | normalized.includes("\0") | |
| 11 | ) { | |
| 7 | if (normalized.length === 0 || normalized.startsWith("..") || normalized.includes("\0")) { | |
| 12 | 8 | return null; |
| 13 | 9 | } |
| 14 | 10 | return normalized.replace(/\\/g, "/"); |
apps/server/src/imageMime.ts+2| ... | ... | @@ -1,5 +1,7 @@ |
| 1 | 1 | import Mime from "@effect/platform-node/Mime"; |
| 2 | 2 | |
| 3 | export const ATTACHMENTS_ROUTE_PREFIX = "/attachments"; | |
| 4 | ||
| 3 | 5 | export const IMAGE_EXTENSION_BY_MIME_TYPE: Record<string, string> = { |
| 4 | 6 | "image/avif": ".avif", |
| 5 | 7 | "image/bmp": ".bmp", |
apps/server/src/orchestration/Layers/ProjectionPipeline.ts+5-2| ... | ... | @@ -38,8 +38,11 @@ import { |
| 38 | 38 | type OrchestrationProjectionPipelineShape, |
| 39 | 39 | } from "../Services/ProjectionPipeline.ts"; |
| 40 | 40 | import { attachmentRouteToRelativePath } from "../../attachmentPaths.ts"; |
| 41 | import { ATTACHMENTS_ROUTE_PREFIX } from "../../projectFaviconRoute.ts"; | |
| 42 | import { inferImageExtension, parseBase64DataUrl } from "../../imageMime.ts"; | |
| 41 | import { | |
| 42 | ATTACHMENTS_ROUTE_PREFIX, | |
| 43 | inferImageExtension, | |
| 44 | parseBase64DataUrl, | |
| 45 | } from "../../imageMime.ts"; | |
| 43 | 46 | |
| 44 | 47 | export const ORCHESTRATION_PROJECTOR_NAMES = { |
| 45 | 48 | projects: "projection.projects", |
apps/server/src/projectFaviconRoute.ts-2| ... | ... | @@ -2,8 +2,6 @@ import fs from "node:fs"; |
| 2 | 2 | import http from "node:http"; |
| 3 | 3 | import path from "node:path"; |
| 4 | 4 | |
| 5 | export const ATTACHMENTS_ROUTE_PREFIX = "/attachments"; | |
| 6 | ||
| 7 | 5 | const FAVICON_MIME_TYPES: Record<string, string> = { |
| 8 | 6 | ".png": "image/png", |
| 9 | 7 | ".jpg": "image/jpeg", |
apps/server/src/wsServer.ts+2-1| ... | ... | @@ -54,8 +54,9 @@ import { clamp } from "effect/Number"; |
| 54 | 54 | import { Open } from "./open"; |
| 55 | 55 | import { ServerConfig } from "./config"; |
| 56 | 56 | import { GitCore } from "./git/Services/GitCore.ts"; |
| 57 | import { ATTACHMENTS_ROUTE_PREFIX, tryHandleProjectFaviconRequest } from "./projectFaviconRoute"; | |
| 57 | import { tryHandleProjectFaviconRequest } from "./projectFaviconRoute"; | |
| 58 | 58 | import { normalizeAttachmentRelativePath, resolveAttachmentRelativePath } from "./attachmentPaths"; |
| 59 | import { ATTACHMENTS_ROUTE_PREFIX } from "./imageMime.ts"; | |
| 59 | 60 | |
| 60 | 61 | /** |
| 61 | 62 | * ServerShape - Service API for server lifecycle control. |