Refactor: Suffixe in helpers/

This commit is contained in:
MasterAcnolo
2026-03-18 09:13:47 +01:00
parent 1c27cc19cf
commit da393b19d9
13 changed files with 19 additions and 19 deletions

View File

@@ -0,0 +1,21 @@
const path = require("path");
function isValidUrl(url) {
try {
new URL(url);
return true;
} catch {
return false;
}
}
function isSafePath(folder) {
if (!folder || folder.length < 3) return false;
const unsafe = ["System32", "\\Windows"];
const resolved = path.resolve(folder);
return !unsafe.some(u => resolved.includes(u));
}
module.exports = { isValidUrl, isSafePath };