nit
This commit is contained in:
1 parent
128cc21516
commit
5144d32b77
5 files changed
+11
-11
No files matched your search
@@ -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, "/");
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user