mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-17 18:18:11 +00:00
Strict link protocol validation (#577)
This commit is contained in:
parent
7200a06ef0
commit
1563a1b20f
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue