fix: handle undefined/null input in stripHtmlTags function
All checks were successful
CI / update (push) Successful in 1m19s

Adds null check to prevent crash when recipe name or description fields are undefined.
This commit is contained in:
2026-01-19 21:55:28 +01:00
parent 5598b19ec9
commit 50b0e7a70e

View File

@@ -1,7 +1,10 @@
// Function to strip HTML tags from a string
import {load} from 'cheerio';
export function stripHtmlTags(input: string): string {
export function stripHtmlTags(input: string | undefined | null): string {
if (!input) {
return '';
}
const $ = load(input.replace(/­/g, ''));
return $.text();
}