Home / Function/ isAllowedUrl() — astro Function Reference

isAllowedUrl() — astro Function Reference

Architecture documentation for the isAllowedUrl() function in utils.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  0d09cf30_b4d9_6d4f_90ab_58174f1f4543["isAllowedUrl()"]
  6382d0b9_8ae6_1f6a_25b6_41a3e8e6de51["utils.ts"]
  0d09cf30_b4d9_6d4f_90ab_58174f1f4543 -->|defined in| 6382d0b9_8ae6_1f6a_25b6_41a3e8e6de51
  e1326ff1_3ecc_459a_c2d8_37e378c63919["renderErrorMarkdown()"]
  e1326ff1_3ecc_459a_c2d8_37e378c63919 -->|calls| 0d09cf30_b4d9_6d4f_90ab_58174f1f4543
  style 0d09cf30_b4d9_6d4f_90ab_58174f1f4543 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/errors/dev/utils.ts lines 249–259

function isAllowedUrl(url: string): boolean {
	const trimmedUrl = url.trim();
	if (!trimmedUrl) return false;

	try {
		const parsedUrl = new URL(trimmedUrl);
		return ['http:', 'https:'].includes(parsedUrl.protocol);
	} catch {
		return false;
	}
}

Domain

Subdomains

Frequently Asked Questions

What does isAllowedUrl() do?
isAllowedUrl() is a function in the astro codebase, defined in packages/astro/src/core/errors/dev/utils.ts.
Where is isAllowedUrl() defined?
isAllowedUrl() is defined in packages/astro/src/core/errors/dev/utils.ts at line 249.
What calls isAllowedUrl()?
isAllowedUrl() is called by 1 function(s): renderErrorMarkdown.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free