mirror of https://github.com/openclaw/openclaw.git
17 lines
588 B
TypeScript
17 lines
588 B
TypeScript
/**
|
|
* Normalize optional gateway URL-input hostname allowlists.
|
|
*
|
|
* Semantics are intentionally:
|
|
* - missing / empty / whitespace-only list => no hostname allowlist restriction
|
|
* - deny-all URL fetching => use the corresponding `allowUrl: false` switch
|
|
*/
|
|
export function normalizeInputHostnameAllowlist(
|
|
values: string[] | undefined,
|
|
): string[] | undefined {
|
|
if (!values || values.length === 0) {
|
|
return undefined;
|
|
}
|
|
const normalized = values.map((value) => value.trim()).filter((value) => value.length > 0);
|
|
return normalized.length > 0 ? normalized : undefined;
|
|
}
|