mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
handle bad read of raw data
This commit is contained in:
@ -1100,6 +1100,8 @@ app.post("/renamecharacter", jsonParser, async function (request, response) {
|
||||
try {
|
||||
// Read old file, replace name int it
|
||||
const rawOldData = await charaRead(oldAvatarPath);
|
||||
if (rawOldData === false || rawOldData === undefined) throw new Error("Failed to read character file");
|
||||
|
||||
const oldData = getCharaCardV2(json5.parse(rawOldData));
|
||||
_.set(oldData, 'data.name', newName);
|
||||
_.set(oldData, 'name', newName);
|
||||
|
Reference in New Issue
Block a user