diff --git a/index.js b/index.js index 4382568..2ccb6c2 100644 --- a/index.js +++ b/index.js @@ -19,6 +19,16 @@ const SwalConfig = { buttonsStyling: false, } +const invalidChars = ['/', '\\', '>', '<', ':', '*', '|', '"', '\'', '?', '\0']; + +const replaceInvalid = (str) => { + var cache = str; + invalidChars.forEach(ch => { + cache = cache.replace(ch, "#"); + }); + return cache; +} + const isOverflown = ({ clientHeight, scrollHeight }) => scrollHeight > clientHeight const setCookie = (cname, cvalue, exdays) => { @@ -134,6 +144,7 @@ const generateSSH = async (name, id, token) => { generateKeyPair("RSASSA-PKCS1-v1_5", 4096, "namehere") .then((keys) => { var KeyExport = new JSZip(); + name = replaceInvalid(name); KeyExport.file("HackersTownTTY-"+name, keys[0]); KeyExport.file("HackersTownTTY-"+name+".pub", keys[1]); KeyExport.generateAsync({type:"blob"}) diff --git a/send.php b/send.php index 4affb01..28bca81 100644 --- a/send.php +++ b/send.php @@ -1,4 +1,6 @@