mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-15 18:24:11 +00:00
stricter url records
This commit is contained in:
@@ -165,13 +165,8 @@ t("All files should have valid record values", (t) => {
|
||||
}
|
||||
|
||||
if (key === "URL") {
|
||||
t.true(value.startsWith("http://") || value.startsWith("https://"), `${file}: Record value for ${key} must start with http:// or https://`)
|
||||
t.notThrows(() => new URL(value), `${file}: Invalid URL for ${key}`);
|
||||
try {
|
||||
const urlObj = new URL(value);
|
||||
t.true(urlObj.hostname !== subdomain, `${file}: URL cannot point to itself`);
|
||||
} catch {
|
||||
t.fail(`${file}: Invalid URL for ${key}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user