From fb6fa54c7fb3ad317d5293a92d9ad03d30530cd7 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:57:38 +0200 Subject: [PATCH] Fix import fetch HTTP method --- src/endpoints/content-manager.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/endpoints/content-manager.js b/src/endpoints/content-manager.js index 727715a95..32877173d 100644 --- a/src/endpoints/content-manager.js +++ b/src/endpoints/content-manager.js @@ -226,9 +226,7 @@ async function downloadChubCharacter(id) { * @returns {Promise<{buffer: Buffer, fileName: string, fileType: string}>} */ async function downloadPygmalionCharacter(id) { - const result = await fetch(`https://server.pygmalion.chat/api/export/character/${id}/v2`, { - method: 'POST', - }); + const result = await fetch(`https://server.pygmalion.chat/api/export/character/${id}/v2`); if (!result.ok) { const text = await result.text(); @@ -237,25 +235,25 @@ async function downloadPygmalionCharacter(id) { } const jsonData = await result.json(); - const card = jsonData?.card; + const characterData = jsonData?.character; - if (!card || typeof card !== 'object') { + if (!characterData || typeof characterData !== 'object') { console.error('Pygsite returned invalid character data', jsonData); throw new Error('Failed to download character'); } try { - const avatarUrl = card?.data?.avatar; + const avatarUrl = characterData?.data?.avatar; if (!avatarUrl) { - console.error('Pygsite character does not have an avatar', card); + console.error('Pygsite character does not have an avatar', characterData); throw new Error('Failed to download avatar'); } const avatarResult = await fetch(avatarUrl); const avatarBuffer = await avatarResult.buffer(); - const cardBuffer = characterCardParser.write(avatarBuffer, JSON.stringify(card)); + const cardBuffer = characterCardParser.write(avatarBuffer, JSON.stringify(characterData)); return { buffer: cardBuffer,