mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
More clear message for character import failure
This commit is contained in:
@@ -6838,6 +6838,11 @@ function importCharacter(file) {
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
success: async function (data) {
|
success: async function (data) {
|
||||||
|
if (data.error) {
|
||||||
|
toastr.error('The file is likely invalid or corrupted.', 'Could not import character');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.file_name !== undefined) {
|
if (data.file_name !== undefined) {
|
||||||
$('#character_search_bar').val('').trigger('input');
|
$('#character_search_bar').val('').trigger('input');
|
||||||
$("#rm_info_block").transition({ opacity: 0, duration: 0 });
|
$("#rm_info_block").transition({ opacity: 0, duration: 0 });
|
||||||
|
@@ -61,6 +61,11 @@ const parse = async (cardUrl, format) => {
|
|||||||
return PNGtext.decode(chunk.data);
|
return PNGtext.decode(chunk.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (textChunks.length === 0) {
|
||||||
|
console.error('PNG metadata does not contain any character data.');
|
||||||
|
throw new Error('No PNG metadata.');
|
||||||
|
}
|
||||||
|
|
||||||
return Buffer.from(textChunks[0].text, 'base64').toString('utf8');
|
return Buffer.from(textChunks[0].text, 'base64').toString('utf8');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user