fixed bug preventing character creation

This commit is contained in:
RossAscends
2023-04-29 14:19:43 +09:00
parent a211bda103
commit f5dcc79022

View File

@@ -646,7 +646,7 @@ app.post("/createcharacter", urlencodedParser, function (request, response) {
const internalName = getPngName(request.body.ch_name); const internalName = getPngName(request.body.ch_name);
const avatarName = `${internalName}.png`; const avatarName = `${internalName}.png`;
const defaultAvatar = './public/img/ai4.png'; const defaultAvatar = './public/img/ai4.png';
const chatsPath = path.join(chatsPath, internalName); chatsPath = path.join(chatsPath, internalName);
if (!fs.existsSync(chatsPath)) fs.mkdirSync(chatsPath); if (!fs.existsSync(chatsPath)) fs.mkdirSync(chatsPath);
@@ -681,7 +681,7 @@ app.post("/renamecharacter", jsonParser, async function (request, response) {
const oldData = json5.parse(rawOldData); const oldData = json5.parse(rawOldData);
oldData['name'] = newName; oldData['name'] = newName;
const newData = JSON.stringify(oldData); const newData = JSON.stringify(oldData);
// Write data to new location // Write data to new location
await charaWrite(oldAvatarPath, newData, newInternalName); await charaWrite(oldAvatarPath, newData, newInternalName);