authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-28 23:14:17-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-03-01 20:06:21-08:00
log5144d32b771cb64c7e6e7aa0d109e480a4382a01
tree9a3ae351f8c5a36dd6724b5c3a9914395effb17e
parent128cc215167cfd2c9696cdc657c870954d972db2

nit


5 files changed, 11 insertions(+), 11 deletions(-)

apps/server/src/attachmentPaths.ts+2-6
...@@ -1,14 +1,10 @@...@@ -1,14 +1,10 @@
1import path from "node:path";1import path from "node:path";
22
3import { ATTACHMENTS_ROUTE_PREFIX } from "./projectFaviconRoute.ts";3import { ATTACHMENTS_ROUTE_PREFIX } from "./imageMime.ts";
44
5export function normalizeAttachmentRelativePath(rawRelativePath: string): string | null {5export 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 @@
1import Mime from "@effect/platform-node/Mime";1import Mime from "@effect/platform-node/Mime";
22
3export const ATTACHMENTS_ROUTE_PREFIX = "/attachments";
4
3export const IMAGE_EXTENSION_BY_MIME_TYPE: Record<string, string> = {5export 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";
40import { attachmentRouteToRelativePath } from "../../attachmentPaths.ts";40import { attachmentRouteToRelativePath } from "../../attachmentPaths.ts";
41import { ATTACHMENTS_ROUTE_PREFIX } from "../../projectFaviconRoute.ts";41import {
42import { inferImageExtension, parseBase64DataUrl } from "../../imageMime.ts";42 ATTACHMENTS_ROUTE_PREFIX,
43 inferImageExtension,
44 parseBase64DataUrl,
45} from "../../imageMime.ts";
4346
44export const ORCHESTRATION_PROJECTOR_NAMES = {47export 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";
2import http from "node:http";2import http from "node:http";
3import path from "node:path";3import path from "node:path";
44
5export const ATTACHMENTS_ROUTE_PREFIX = "/attachments";
6
7const FAVICON_MIME_TYPES: Record<string, string> = {5const 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";
54import { Open } from "./open";54import { Open } from "./open";
55import { ServerConfig } from "./config";55import { ServerConfig } from "./config";
56import { GitCore } from "./git/Services/GitCore.ts";56import { GitCore } from "./git/Services/GitCore.ts";
57import { ATTACHMENTS_ROUTE_PREFIX, tryHandleProjectFaviconRequest } from "./projectFaviconRoute";57import { tryHandleProjectFaviconRequest } from "./projectFaviconRoute";
58import { normalizeAttachmentRelativePath, resolveAttachmentRelativePath } from "./attachmentPaths";58import { normalizeAttachmentRelativePath, resolveAttachmentRelativePath } from "./attachmentPaths";
59import { ATTACHMENTS_ROUTE_PREFIX } from "./imageMime.ts";
5960
60/**61/**
61 * ServerShape - Service API for server lifecycle control.62 * ServerShape - Service API for server lifecycle control.