Files
openclaw/src/plugins/http-path.ts
2026-04-07 06:55:45 +01:00

17 lines
518 B
TypeScript

import { normalizeOptionalString } from "../shared/string-coerce.js";
export function normalizePluginHttpPath(
path?: string | null,
fallback?: string | null,
): string | null {
const trimmed = normalizeOptionalString(path);
if (!trimmed) {
const fallbackTrimmed = normalizeOptionalString(fallback);
if (!fallbackTrimmed) {
return null;
}
return fallbackTrimmed.startsWith("/") ? fallbackTrimmed : `/${fallbackTrimmed}`;
}
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
}