mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-11 09:10:13 +01:00
15 lines
271 B
JavaScript
15 lines
271 B
JavaScript
const VALID_PROTOCOLS = ["https:", "http:"];
|
|
|
|
function validURL(url) {
|
|
try {
|
|
const destination = new URL(url);
|
|
if (!VALID_PROTOCOLS.includes(destination.protocol)) return false;
|
|
return true;
|
|
} catch {}
|
|
return false;
|
|
}
|
|
|
|
module.exports = {
|
|
validURL,
|
|
};
|