Fixed YAML index file parser failing on duplicate keys.

This commit is contained in:
2024-09-11 05:16:58 +02:00
parent aec5ce292d
commit afaa428fec
3 changed files with 10 additions and 5 deletions

View File

@@ -13,9 +13,9 @@ async function getIndex(user) {
try {
const indexFile = await fs.readFile(indexFilePath, 'utf8');
return yaml.safeLoad(indexFile);
return yaml.safeLoad(indexFile, { json: true }); // allow duplicate keys
} catch (error) {
logger.info(`No index file found for '${user.name}' at '${indexFilePath}'`);
logger.info(`No index file found for '${user.name}' at '${indexFilePath}': ${error.message}`);
return { profile: { image: null, description: null }, posts: [] };
}