mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-27 14:31:17 -07:00
Fix whitespace only urls
This commit is contained in:
@@ -11,9 +11,10 @@ function getText(node) {
|
||||
}
|
||||
|
||||
export function httpUrl(value, baseUrl) {
|
||||
if (!value) return null;
|
||||
const trimmed = value?.trim();
|
||||
if (!trimmed) return null;
|
||||
try {
|
||||
const url = new URL(value.trim(), baseUrl);
|
||||
const url = new URL(trimmed, baseUrl);
|
||||
return ["http:", "https:"].includes(url.protocol) ? url.href : null;
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user