diff --git a/src/pngv3.ts b/src/pngv3.ts index b89bb75..be90022 100644 --- a/src/pngv3.ts +++ b/src/pngv3.ts @@ -61,7 +61,7 @@ const extractFromRawDeflate = (b: Buffer) => { const hidden = new BitstreamWriter({ write(chunk) { for (const i of chunk) { - if (i) + if (i >= 0x20 && i <= 128) // only printable ascii chnks.push(i); else throw "Finish"; @@ -234,9 +234,8 @@ const extract = async (png: Buffer, doextract = true) => { .toString() .split(' ') .map(e => { - if (!(e[0] in rprefs)) + if (!(e[0] in rprefs) || e[1].length < 5) // link needs to be long enough, avoid false positives throw "Uhh"; - // should also check if the id has a len of 6-8 or ends in .pee return `https://${rprefs[e[0]]}/${e.slice(1)}`; }).join(' '); if (doextract)