mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-10-02 08:50:11 +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) {
|
||||
try {
|
||||
new URL(url);
|
||||
const destination = new URL(url);
|
||||
if (!VALID_PROTOCOLS.includes(destination.protocol)) return false;
|
||||
return true;
|
||||
} catch {}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user