mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-20 22:20:39 +01:00
handle bad read of raw data
This commit is contained in:
parent
c1b76b5f48
commit
49aff85472
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user