mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 16:47:29 +00:00
15 lines
413 B
TypeScript
15 lines
413 B
TypeScript
export function normalizePluginHttpPath(
|
|
path?: string | null,
|
|
fallback?: string | null,
|
|
): string | null {
|
|
const trimmed = path?.trim();
|
|
if (!trimmed) {
|
|
const fallbackTrimmed = fallback?.trim();
|
|
if (!fallbackTrimmed) {
|
|
return null;
|
|
}
|
|
return fallbackTrimmed.startsWith("/") ? fallbackTrimmed : `/${fallbackTrimmed}`;
|
|
}
|
|
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
}
|