mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Save uploaded data unchanged if Chub conversion fails for any reason
Avoid non-resolving promise in /characters/chats readline if chat file is empty
This commit is contained in:
@ -1027,6 +1027,12 @@ router.post('/chats', jsonParser, async function (request, response) {
|
||||
const stats = fs.statSync(pathToFile);
|
||||
const fileSizeInKB = `${(stats.size / 1024).toFixed(2)}kb`;
|
||||
|
||||
if (stats.size === 0) {
|
||||
console.log(`Found an empty chat file: ${pathToFile}`);
|
||||
res({});
|
||||
return;
|
||||
}
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: fileStream,
|
||||
crlfDelay: Infinity,
|
||||
|
Reference in New Issue
Block a user