mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-13 06:08:12 +09:00
Fix bug
C#っぽく使ってしまっていた。
This commit is contained in:
parent
8b01307afb
commit
7cabdb4174
@ -57,7 +57,7 @@ function tryCreateUrl(url: string) {
|
|||||||
|
|
||||||
function validateUrl(url: string) {
|
function validateUrl(url: string) {
|
||||||
const result = tryCreateUrl(url);
|
const result = tryCreateUrl(url);
|
||||||
if (result.pathname.trim('/').length) throw `url="${url}" is not a valid URL, has a pathname.`;
|
if (result.pathname.replace('/', '').length) throw `url="${url}" is not a valid URL, has a pathname.`;
|
||||||
if (!url.includes(result.host)) throw `url="${url}" is not a valid URL, has an invalid hostname.`;
|
if (!url.includes(result.host)) throw `url="${url}" is not a valid URL, has an invalid hostname.`;
|
||||||
if (!/^https?:$/.test(result.protocol)) throw `url="${url}" is not a valid URL, has an invalid protocol.`;
|
if (!/^https?:$/.test(result.protocol)) throw `url="${url}" is not a valid URL, has an invalid protocol.`;
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user