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