Skip to content

Commit cd8eebd

Browse files
authored
Handle missing data better (#3845)
1 parent ef6e5de commit cd8eebd

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/tools/generate/generate_rss.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const generate_rss = async (configs, rss_chapters, rss_languages) => {
3333
const updatedate = get_update_date(`${language}/${year}/chapters/${chapter}.html`);
3434
const url = convert_file_name(`${language}/${year}/${chapter}`);
3535
title = `${title} (${year})`;
36-
authors = authors.map(author => configs[year].contributors[author].name.replace(/\\/g, '\\\\').replace(/"/g, '\\"'));
36+
authors = authors.map(author => configs[year].contributors[author]?.name?.replace(/\\/g, '\\\\')?.replace(/"/g, '\\"'));
3737
authors = '"' + authors.join('","') + '"';
3838

3939
// Capture the latest updated date as the overall rss updated date

src/tools/generate/shared.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ simpleConverter.setOption('ghMentions', false);
2424

2525
const convertSimpleMarkdown = (text) => {
2626
// Showdown replaces & with & so convert those back to avoid escape issues
27-
let convertedText = text.replace(/&/g,'&');
27+
let convertedText = text?.replace(/&/g,'&');
2828
convertedText = simpleConverter.makeHtml(convertedText);
2929
// As we've converted again, need to convert back & again
30-
convertedText = convertedText.replace(/&/g,'&');
30+
convertedText = convertedText?.replace(/&/g,'&');
3131
// Strip paragraph tags from beginning and end
32-
convertedText = convertedText.replace(/^<p>/,'');
33-
convertedText = convertedText.replace(/<\/p>$/,'');
32+
convertedText = convertedText?.replace(/^<p>/,'');
33+
convertedText = convertedText?.replace(/<\/p>$/,'');
3434
return convertedText;
3535
};
3636

0 commit comments

Comments
 (0)