mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-15 11:11:09 +00:00
17 lines
518 B
TypeScript
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}`;
|
|
}
|