From a22bf58719b30070fc03273328f786e76026a3a7 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Thu, 29 May 2025 05:14:21 -0400 Subject: [PATCH] fix truncation --- lib.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib.js b/lib.js index f345980..33d58bd 100644 --- a/lib.js +++ b/lib.js @@ -40,7 +40,6 @@ async function splitUp(content) { let san = sanitize(path.split('/').pop(), ''); try { content = await readFile(`${process.cwd()}/uploads/${san}`, 'utf-8'); - content.length = Math.min(content.length,5000); } catch (err) { content = ''; } @@ -62,6 +61,8 @@ async function splitUp(content) { height = contentJson.height; } + content = content.slice(0,Math.min(content.length,4000) - 1); + out[i] = { type: 'file', path, ext, content, width, height, encoded }; continue; }