fix truncation

This commit is contained in:
biglyderv 2025-05-29 05:14:21 -04:00
parent 718b912719
commit a22bf58719
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5

3
lib.js
View file

@ -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;
}