Skip to content
Snippets Groups Projects
Unverified Commit 1563a1b2 authored by Timothy Carambat's avatar Timothy Carambat Committed by GitHub
Browse files

Strict link protocol validation (#577)

parent 7200a06e
No related branches found
No related tags found
No related merge requests found
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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment