Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/api/test-page-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,18 @@ export function getUrl (url: string, base?: URL): string {
}

export function prepareBaseUrl (url: string): URL {
url = join(url, '/');
return isAbsolute(url) ? pathToFileURL(url) : new URL(url);
// If it's a web URL (http/https), use it directly
if (/^https?:\/\//i.test(url)) {
return new URL(url.endsWith('/') ? url : url + '/');
}

// Handle file URLs explicitly
if (/^file:\/\//i.test(url)) {
return new URL(url);
}

// Otherwise, treat it as filesystem path
return pathToFileURL(isAbsolute(url) ? url : join(process.cwd(), url));
}

export function assertPageUrl (url: string, callsiteName: string): void {
Expand Down