style: 参数校验多语言翻译

This commit is contained in:
TsMask
2024-05-30 15:32:42 +08:00
parent bc59dc67e6
commit 6592561bca
3 changed files with 37 additions and 36 deletions

View File

@@ -84,13 +84,14 @@ export function validURL(str: string) {
// http:// is appended so url.Parse will succeed, strTemp used so it does not impact rxURL.MatchString
strTemp = 'http://' + str;
}
debugger;
let u = { host: '', pathname: '' };
try {
new URL(strTemp);
} catch (error) {
return false;
}
const u = new URL(strTemp);
if (u.host.startsWith('.')) {
return false;
}