fix truncation
This commit is contained in:
parent
718b912719
commit
a22bf58719
1 changed files with 2 additions and 1 deletions
3
lib.js
3
lib.js
|
@ -40,7 +40,6 @@ async function splitUp(content) {
|
||||||
let san = sanitize(path.split('/').pop(), '');
|
let san = sanitize(path.split('/').pop(), '');
|
||||||
try {
|
try {
|
||||||
content = await readFile(`${process.cwd()}/uploads/${san}`, 'utf-8');
|
content = await readFile(`${process.cwd()}/uploads/${san}`, 'utf-8');
|
||||||
content.length = Math.min(content.length,5000);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
content = '';
|
content = '';
|
||||||
}
|
}
|
||||||
|
@ -62,6 +61,8 @@ async function splitUp(content) {
|
||||||
height = contentJson.height;
|
height = contentJson.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content = content.slice(0,Math.min(content.length,4000) - 1);
|
||||||
|
|
||||||
out[i] = { type: 'file', path, ext, content, width, height, encoded };
|
out[i] = { type: 'file', path, ext, content, width, height, encoded };
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue