mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-10-04 01:40:12 +02:00
Strict link protocol validation (#577)
This commit is contained in:
parent
7200a06ef0
commit
1563a1b20f
@ -1,6 +1,9 @@
|
|||||||
|
const VALID_PROTOCOLS = ["https:", "http:"];
|
||||||
|
|
||||||
function validURL(url) {
|
function validURL(url) {
|
||||||
try {
|
try {
|
||||||
new URL(url);
|
const destination = new URL(url);
|
||||||
|
if (!VALID_PROTOCOLS.includes(destination.protocol)) return false;
|
||||||
return true;
|
return true;
|
||||||
} catch {}
|
} catch {}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user